This project has moved. For the latest updates, please go here.

OwinHost.exe and adding binding redirects

Sep 2, 2013 at 5:54 AM
I'm using OwinHost.2.0.1-rtw1-20831-600-dev.

When I invoke the OwinHost.exe under the right path, I'm getting the following exception (which makes sense):
Could not load file or assembly 'System.Web.Http, Version=4.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'm getting the same exception under IISExpress but when I add the following binding redirects to web.config under IISExpress, my problem is solved:
     <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
Under my class library (which OwinHost.exe is working on), I added the same binding redirects inside the App.config file and copied this under bin folder. It didn't work. Then, I added the binding redirects inside the OwinHost.exe.config. That didn't work either.

What is the right solution for this problem with OwinHost.exe?
Coordinator
Sep 2, 2013 at 2:56 PM
OwinHost.exe follows the Web Application project template conventions. You need a file called Web.Config in your bin directory for these settings.
Sep 6, 2013 at 7:39 AM
Hi Chris,

Thanks a lot for the response. Will try that.