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!
-
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– Brad Christie2012-11-29 16:11:06 +00:00Commented Nov 29, 2012 at 16:11
Add a comment
|
1 Answer
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
1 Comment
MaxReac
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!