I have an issue with Autofac. The documentation clearly states that when using Web API 2 and OWIN you must not use GlobalConfiguration.Configuration
anywhere:
A common error in OWIN integration is use of the GlobalConfiguration.Configuration. In OWIN you create the configuration from scratch. You should not reference GlobalConfiguration.Configuration anywhere when using the OWIN integration.
which can be found here (at the bottom of the page): http://autofac.readthedocs.io/en/latest/integration/webapi.html
But no matter what I do, I can not get Autofac to work using:
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
instead of:
GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
When I use the latter, it works. Does anyone know why?