Robert Harvey
Robert Harvey

Reputation: 180777

ASP.NET MVC: Default page works, but other pages return 404 error

I created a "Hello World" application, in the same vein as http://giantflyingsaucer.com/blog/?p=409. It works perfectly on my development computer, using the built-in web server.

I followed Phil Haack's advice for doing a Bin Deployment at http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx. I used the Publish feature to get an output directory, and copied all of the files to the correct places on the ISP (Network Solutions).

When I go to the site, I get the welcome page, but when I do http://mydomain/hello, I get a 404 error.

What could be the problem?


Here is the fix. Apparently Network Solutions is running IIS6 after all. I got what I needed from http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/. The new routing is

{controller}.aspx/{action}/{id}

Notice the addition of the .aspx after the controller placeholder. IIS6 needs this because it always thinks it is talking to an actual web page instead of a controller.

I'm not keen on the extra characters in the url, but I may have to live with it.

Upvotes: 1

Views: 2412

Answers (4)

JoshRivers
JoshRivers

Reputation: 10290

I had troubling 404 errors until I copied over 'PrecompiledApp.config'

Upvotes: 0

Badaro
Badaro

Reputation: 3480

Another long shot: Do you know if your host has ASP.NET MVC installed in the server? If he doesn't, you need to copy the three MVC DLLs to your BIN folder as well.

Upvotes: 1

Ben Griswold
Ben Griswold

Reputation: 18321

This is a long shot but this very honestly happened to me today. Are you sure you have IIS configured completely? Under the Web Service Extensions node, enable/allow ASP.NET. If this isn't allowed, you'll get a 404 error.

Upvotes: 0

Çağdaş Tekin
Çağdaş Tekin

Reputation: 16651

Are you sure you deployed it to an IIS7 server? If the server runs IIS6 check this and this post.

Upvotes: 3

Related Questions