1

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!

1
  • If you debug through it, what's the actual error that's generating the 404? Do you have a stack trace or exception occurring? Commented Nov 29, 2012 at 16:11

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.