问题
I just upgraded ASP.NET MVC 3 to ASP.NET MVC 4 with .NET 4.5 and root controllers were working but controllers in MVC Area started giving 404 errors.
I looked up for IIS 7 QFE patch, but it is not applicable to windows 8. By setting breakpoints, I could see that area was registered successfully and also after complete registration, I see 4 routes registered in routes collection and first one is the route corresponding to area. But any request for area url just falls to 404 error.
回答1:
I am leaving this answer for everyone who faces problem during upgrade.
I had a business logic library (a different .NET class library) which was compiled against ASP.NET MVC 3.
If you use any references to other library which was compiled against ASP.NET MVC 3 in ASP.NET MVC 4 project, then web server does not raise any error, but instead it is not able to load controllers that were dependent on external library so instead of showing a loading error, it simply throws 404 error as it assumes that controller was not found.
Controllers defined in same area worked well if they were not dependent on external library compiled against MVC3.
In short "Any controller, depending upon types from any library compiled against MVC3 will not load, and 404 error will be raised".
Ideally it should have raised an error.
来源:https://stackoverflow.com/questions/15503889/upgrading-from-asp-net-mvc-3-to-asp-net-mvc-4-leads-to-404-errors