FileLoadException on 'Microsoft.Owin'
-
23-12-2019 - |
Question
So I have installed SignalR through Nuget and it is depending on Microsoft.Owin
which it then installed. Whenever I run my application it throws a FileLoadException
in the Startup.cs om the app.MapSignalR();
line. It says "File or assembly 'Microsoft.Owin, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies could not be loaded. The manifest definition of the found assembly do not match the reference of the assembly."
I am sure it includes the Microsoft.Owin.dll
but when I try to reinstall it through Nuget it says it could not reinstall the Microsoft.Owin.XML
Startup.cs
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
}
Solution
The latest version of SignalR relies on Microsoft.Owin 2.0.2.0, not 2.0.1.0. See the following tutorial- you'll want to add Microsoft.AspNet.SignalR.SelfHost in the package manager, not Microsoft.Owin.
OTHER TIPS
Sometimes packages refer to specific versions of other packages. You can try to add a binding redirect for Microsoft.Owin
in your web.config
file (in the <runtime>
section):
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
This tells everything that references an older version than 2.1.0.0
to use 2.1.0.0
instead.