Autofac with Owin

后端 未结 1 1319
北恋
北恋 2021-01-27 06:10

I have an issue with Autofac. The documentation clearly states that when using Web API 2 and OWIN you must not use GlobalConfiguration.Co

相关标签:
1条回答
  • 2021-01-27 06:41

    Ok, I figured this out. I will post the answer here incase anyone else has this issue. As the documentation stated, you can't use GlobalConfiguration anywhere.... so I did a search and I found it somewhere else. I had this:

    GlobalConfiguration.Configure(WebApiConfig.Register); 
    

    which should have been:

    WebApiConfig.Register(config); 
    

    When I fixed that, I was able to use the proper

    config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
    
    0 讨论(0)
提交回复
热议问题