Could not load file or assembly Microsoft.Owin on Azure

Viewed 730

My ASP.Net MVC Application works fine when run locally on IIS, but gives the following error when deployed to Azure:

Could not load file or assembly 'Microsoft.Owin, Version=2.1.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)

This is the piece of the stack trace that led me to believe that SignalR is a potential culprit:

[FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.1.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)]
   Owin.OwinExtensions.MapSignalR(IAppBuilder builder, String path, HubConfiguration configuration) +0
   Owin.OwinExtensions.MapSignalR(IAppBuilder builder, HubConfiguration configuration) +12
   QuikWorx.O365Web.Startup.Configuration(IAppBuilder app) +169

According to NuGet, I have version 3.0.1 of Microsoft.Owin installed on the application, but apparently something (SignalR) requires version 2.1.0. I would have thought that the following bindingRedirect would force SignalR to use the installed version 3.0.1 (verified present, version 3.0.1 in /bin on Azure):

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
  </dependentAssembly>

...but alas, this is not the case.

I've also tried the following without success:

  • Forced reinstall of Microsoft.Owin 3.0.1 with NuGet.
  • Forced reinstall of the SignalR component (Microsoft.AspNet.SignalR.Core) that requires Microsoft.Owin 2.1.0 with NuGet
  • Changing the oldVersion of the bindingRedirect for Microsoft.Owin to "0.0.0.0-2.1.0.0" (this makes no sense)
  • Removing the bindingRedirect for Microsoft.Owin
  • Deleting all files and folders in the site directory using rd /Q /S in Kudu

Is there anything else that I could attempt?

1 Answers
Related