MVC4 gives me an error that my controller does not have a default constructor. Of course it does not, but StructureMap can handle that. It's an ApiController.In app startup: var container = Bootstrapper.RegisterDependencies(); DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));In the Bootstrapper, I register controllers with SM: factory.Scan(x => { x.AddAllTypesOf<IHttpController>(); x.AddAllTypesOf<IController>(); });I have confirmed that the ApiController in question is in fact registered with SM.I even created a controller factory and told SM about that too (even though I think I should not have to do that): factory.For<IHttpControllerFactory>().Use<HttpControllerFactory>();When requesting an action on the controller, my StructureMapDependencyResolver is never called. Neither is my HttpControllerFactory.This is the stack trace:at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpControllerContext controllerContext, Type controllerType)\u000d\u000a at System.Web.Http.Dispatcher.DefaultHttpControllerFactory.CreateInstance(HttpControllerContext controllerContext, HttpControllerDescriptor controllerDescriptor)\u000d\u000a at System.Web.Http.Dispatcher.DefaultHttpControllerFactory.CreateController(HttpControllerContext controllerContext, String controllerName)\u000d\u000a at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken)\u000d\u000a at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)As you can see the dispatcher uses the default controller factory, which uses the default activator, which obviously does not use my dependency resolver that I have told the framework to use.I can't find any other way to configure the controller factory for IHttpControllers, so I'm blocked.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...