MVC 3 on IIS 7 returns 404 for MVC extensionless url requests

Our website is a mix of asp.net web-forms and MVC 3. The website is developed in web-forms, except for a separate MVC application that is stored in a separate Directory in the root of the website and having its own web.config. The web-forms pages (aspx) are served properly by the IIS 7 server, but MVC url's are returning 404 - File or directory not found.

For example, say the website is www.abc.com and the MVC application is accessed using www.abc.com/aaa/controller/action , where aaa is the root directory for the MVC application and contains its own web.config. The web-forms url (say www.abc.com/feedback.aspx) is working but, the MVC URL's (say (www.abc.com/aaa/Controller/Action) are returning 404.

I have confirmed from my shared hosting provider, that the website is running over .net 4 Integrated pipeline Mode application pool, so extensionless url's should be handled by the IsapiModule by default, without requiring any extra configuration for the same.

One doubt that crops in my mind is whether the MVC application root folder ( aaa in above example) should be converted to a separate application ?

Any guesses, to resolve the above MVC url issue?


The hosting provider uses WebsitePanel , through which I was able to create a Virtual Directory for the folder containing the MVC application. The MVC URL's are now being routed to the Isapi handler and not returning 404(file not found) any more. So, I guess I will close this topic here.

In short, creating a virtual directory for the MVC application resolved the issue.


asp.net-mvc and webforms share the routing system. You should make a Hybrid WebApp, part WebForm and MVC. I did something similar recently here, where the webforms is the main app and the MVC is the nested one. In this case, you must have only one global.asax and a single web.config for the entire site. The MVC could live at the same directory as the WebForm, but only with they share stuff.

I followed this guide from Scott Hanselman to make this work.

链接地址: http://www.djcxy.com/p/74352.html

上一篇: Elmah陷入默认路线?

下一篇: IIS 7上的MVC 3为MVC无扩展url请求返回404