MVC WebApi not using AutofacWebApiDependencyResolver
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a mixed MVC 4 app, where some controllers are regular implementations of Controller and some controllers are implementations of ApiController . I'm also using Autofac for DI, but it appears that the WebApi controller "activator" machinery (for lack for a more specific term) is not using the Autofac resolver ( AutofacWebApiDependencyResolver ), which leads to an exception being thrown when I make a request against one of my api controllers. Here's the error: <Error> <Message>An error has occurred.</Message> <ExceptionMessage> Type