whall
whall

Reputation: 21

ASP.NET MVC 2 Routing Errors

After publishing an ASP.NET MVC 2 web application to my schools IIS 7.5 server, I receive a 403 error on initial load and then a 404 error if I try and invoke a route such as /Home/About/Index

I have even tried publishing the default ASP.NET MVC 2 sample application, but with no luck. It appears that the Web Server isn't picking up any of the routes and that it is determining /Home/About/Index to be a directory look-up. Has anyone else experienced similar issues?

I spoke with the system admin and verified that HTTP Redirection and HTTP Errors are enabled. After poking around on, I have seen several comments about routing not working due to the publish location not being a webroot. Any comments on why?

Currently the system admin has the following website directory structure. Could this be the problem?

I have sought help from the system admin and my professor, however both are unfamiliar with MVC and routing. Any help is appreciated.

Of course, I can just give up on my idea and just use Web Forms and SOAP much like I have done in my other classes, but I would like to learn more about MVC in ASP.NET and REST. Thanks for the help!

Upvotes: 0

Views: 981

Answers (3)

whall
whall

Reputation: 21

So it looks like the system admin had the app pool to classic mode when it needs to be in integrated. In the default ASP.NET MVC 2 sample application I modified the Global.asax to:

routes.MapRoute(
    "Default",
    "{controller}.aspx/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

And navigated to /Home.aspx/About, everything worked fine.

Now I just need to convince our system admin to change to integrated.

References: http://server.dzone.com/news/routes-iis-classic-and

EDIT: I was able to get the system admin to switch to integrated. Everything appears to be working fine.

Upvotes: 2

mcguirk
mcguirk

Reputation: 1

Could it be that you need to set up IIS to map wildcards? I know this is for IIS 6 but it may apply to 7 too.

http://www.techdreams.org/microsoft/aspnet/how-to-fix-404-errors-of-aspnet-mvc-website-deployed-on-iis-6-windows-server-2003/2572-20090515

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

If you are using default routes the correct url should be /Home/About. As far as deploying an ASP.NET MVC application on II 7 is concerned you probably want to go through the following blog post.

Upvotes: 1

Related Questions