MVC3 routing not working after deployment on IIS7.

2019-05-05 13:57发布

问题:

After creating a Web Application project in VS2010, adding a routing route and run in debug mode the routing seems to work properly and I have no problem.

But when I tried to deploy it on IIS7.5 on my local machine, and tried to click a link that uses routing it throws: "HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Does anyone encountered the same issue?

回答1:

Sounds like you are missing the module for UrlRouting.

  1. Go to the site in IIS
  2. Click on Modules
  3. Look for an module of type: System.Web.Routing.UrlRoutingModule(in my IIS the name is UrlRoutingModule-4.0)
  4. If you can't find it click "Add Managed Module" and paste the information in last step. Also check the checkbox.

I hope that helps. If that isn't the problem check if you are running under Integrated mode(Look at the App pool for that application).



回答2:

I was able to resolved this issue and document on how I did it here:

http://czetsuya-tech.blogspot.com/2011/06/how-to-deploy-mvc3-powered-website-to.html