Dependency on Microsoft.Owin, Version

Oct 30, 2013 at 8:08 PM
I'm trying to build a new ASP.NET Web API project and host it using Katana in a Windows Azure worker role. I'm following the guidance outline in

I've installed the Microsoft.AspNet.WebApi.OwinSelfHost package. It seems there is a fixed dependency on version of the Microsoft.Owin assembly. The rest of the assemblies are OK with version 2.0.1.

When trying to run the project, I get an error on the app.UseWebApi(config) line in the code below:
class Startup
        public void Configuration(IAppBuilder app)
            HttpConfiguration config = new HttpConfiguration();
            config.Routes.MapHttpRoute("Default", "{controller}");

The error is:
_=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Owin, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Appbase = file:///D:/Projects/Demos/WindowsAzure3/WindowsAzure3/csx/Debug/roles/WorkerRole1/approot
LOG: Initial PrivatePath = D:\Projects\Demos\WindowsAzure3\WindowsAzure3\csx\Debug\roles\WorkerRole1\approot

Calling assembly : System.Web.Http.Owin, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Projects\Demos\WindowsAzure3\WindowsAzure3\csx\Debug\roles\WorkerRole1\approot\WorkerRole1.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Owin, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///D:/Projects/Demos/WindowsAzure3/WindowsAzure3/csx/Debug/roles/WorkerRole1/approot/Microsoft.Owin.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated._
Nov 1, 2013 at 3:21 PM
Edited Nov 1, 2013 at 3:24 PM
Thanks to @tracher, I've foud a workaround:

Open the app.config file and add the <runtime> node into the configuration node:
<?xml version="1.0" encoding="utf-8" ?>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Microsoft.Owin"
          culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />


to it.

Now everything should work :-)