views:

106

answers:

4

I've started working on my master's project and decided to try something new and use ASP.NET MVC 2. I have Windows 7 Pro and Visual Studio 2010.

I've been following this tutorial http://www.asp.net/mvc/tutorials/mvc-music-store-part-1 and what's driving me insane is that I cannot even get past the first step. I setup my project exactly as the tutorial says, start debugging and all I get is:

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404.

What the hell? I checked the default MVC application that VS01 builds when you choose "ASP.NET MVC 2 App" instead of "ASP.NET MVC 2 Empty App" and it works. I am clueless...

+3  A: 

Short answer, it probably is "working."

If you are using the "Empty App" project template, the behavior you see is exactly what you should expect. In your global.asax, you will see a global route and a default controller set to "Home". However, in an empty project, you have no controllers or views so you get a 404.

Larsenal
Cheers. It works.
barjed
+2  A: 

In an Empty App, you have no Controllers or Views defined, that's why you get that error.

Try comparing to the normal MVC 2 App starting project and create a default Controller & View.

Dan Dumitru
A: 

You need to create a controller and ensure your route table is mapped to it correctly.

Chris Almond
A: 

Hello Chris,

I have the same problem, as discribed above.

I have a Controller, a View and a Model created for my page. However, I have not quite understood how to link a submit button to its corresponding method in the controller. Once I can establish that, I hope I won't get this error again.

I checked the ASPX view page but could not find as to how a submit button is linked to its C# code in Controller ... :-( Could you please help?

Thanks,

Dinesh

Dinesh Jayadevan