I have a simple project which uses Microsoft.AspNet.WebApi.OwinSelfHost. It is a Owin self hosted WebApi 2 project.The project is pretty much similar to:-
https://github.com/attilah/AngularJSAuthentication
The only difference I have is my Security module is in separate Assembly (everything similar to above project). I use Autofac to resolve my dependencies.
This project worked when there's no Autofac. But once I am trying to setup my project with the corresponding security modules and Autofac all I am facing is this error:-
Could not load file or assembly 'System.Web.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
My configuration is very much inspired from this thread:-
Dependency injection not working with Owin self-hosted Web Api 2 and Autofac
Moreover, I found someone else struggled with this dependency bug of Autofac and was able to get similar issue resolved by re-installing Microsoft.AspNet.WebApi.WebHost:
GlobalConfiguration.Configure() not present after Web API 2 and .NET 4.5.1 migration
But this doesn't work for me I don't know why. I've tried re-installing everything from scratch also doesn't help. Besides the fact that Autofac has several permission issues while re-installing as well.
Anybody has any experience with this error? please help. Thanks!