I came across the following error when I tried to host SignalR using OWIN by Azure worker role.
Upon searching over the web, I came across few links (specified some in References).
Reason is specified over here.
https://nuget.codeplex.com/workitem/3827
Could not load file or assembly 'Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Upon searching over the web, I came across few links (specified some in References).
Reason is specified over here.
Fix
We need to add few configuration (specified in Snippet 1) in app.config file of the project where we have specified the SignalR. mapping code.
While incorporating the fix, we need to observe it and tweak the new version accordingly, if required. Just verify the packages.config to understand which version of Microsoft.Owin and Microsoft.Owin.Security dll got installed. Most of the time, Microsoft.Owin dll version might have got changed. Ensure the new version specified in the app.config file to be matched with the one you've installed / specified in packages.config.Snippet 1: (app.config)
<runtime> <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> <dependentAssembly> <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0" /> </dependentAssembly> </assemblyBinding> </runtime>
Snippet 2: (packages.config)
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" /> <package id="Microsoft.Owin.Cors" version="2.1.0" targetFramework="net45" /> <package id="Microsoft.Owin.Diagnostics" version="2.0.2" targetFramework="net45" /> <package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net45" /> <package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net45" /> <package id="Microsoft.Owin.Security" version="2.0.2" targetFramework="net45" /> <package id="Microsoft.Owin.SelfHost" version="2.0.2" targetFramework="net45" />
References:
http://stackoverflow.com/questions/20083185/fileloadexception-when-hosting-signalr-at-azure-worker-role-with-fhttps://nuget.codeplex.com/workitem/3827