I have the following setup:
BaseController1 inherits System.Web.Mvc.Controller. This controller is compiled into a separate dll that is referenced from my project.
BaseController2 inherits BaseController1 in my project.
MyController inherits BaseController2.
When I run application with this setup, I get 404 error.
But if BaseController2 inherits directly System.Web.Mvc.Controller, and I run application with this setup, everything works as expected.
I have default constructor for all inherited controllers with : base() called.
The BaseController1 within assembly is compiled using references to asp.net mvc 3, and my project relies completely on asp.net mvc 4.
Can this be the problem? Or I am doing something wrong.
Thanks in advance!
Asked
Active
Viewed 3,226 times
1

MaxReac
- 13
- 1
- 4
-
If you debug through it, what's the actual error that's generating the 404? Do you have a stack trace or exception occurring? – Brad Christie Nov 29 '12 at 16:11
1 Answers
1
You're doing nothing wrong, but you will have to make MVC look in the specific assembly/namespace:
ControllerBuilder.Current.DefaultNamespaces.Add(
"ExternalAssembly.Controllers");
This has already been answered in this question: asp.net mvc put controllers into a separate project
-
You pointerd me in right direction. The solution was to set 'Specific Version' to false under properties for System.web.mvc dll in Visual Studio. Thanks! – MaxReac Dec 06 '12 at 11:57