0

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.

Akash Kava
  • 39,066
  • 20
  • 121
  • 167

1 Answers1

0

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.

Akash Kava
  • 39,066
  • 20
  • 121
  • 167
  • Actually that makes sense. When you're running as an MVC4 app, registering areas will cause it to look for certain conventions in both naming and type inheritance, and as far as it was concerned you didn't have any classes on your external project that were inheriting from the MVC4 classes it was looking for, so it assumes the assembly does not have an area in it, doesn't register any routes, and gives you a standard 404 message. – Nick Albrecht Mar 19 '13 at 16:17
  • My area was not in external project, my area was in same MVC4 web application, problem was only some controller that derived from some types defined in external project that was compiled against MVC3 did not work. Other controllers in same area did work correctly. – Akash Kava Mar 19 '13 at 16:55