I started by creating a console app and running as a self host OWIN app. Installed Web API and all works fine.
Now I installed the SystemWeb nuget package, change the type of app to "class library", change output folder to "bin\" only.
When I run the application using IIS Express, first time I load the app, I receive an exception:
Could not load file or assembly 'Microsoft.Owin, Version=2.0.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)
I realized that the System.Web.Http.Owin is referencing the Microsoft.Owin -V 2.0.2.0.
In the App.config the following exists:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
</assemblyBinding>
Despite the above, still getting the same exception. Any idea?
Thanks
I had this. Copy the app.config and rename it to web.config. This will enable IIS/IIS Express to use the necessary binding redirects.