29

I'm trying to get SignalR working in an MVC5 project with individual accounts.

The MVC project has by default Owin 2.0.0 and all of the Owin.* components are also 2.0.0.

So I used NuGet to get all the SignalR packages, it automatically resolved dependancies and downloaded v 2.0.2.

The project throws an error on startup with the following message:

Could not load file or assembly 'Microsoft.Owin, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I also tried upgrading Owin to 2.1.0 but that didn't help either.

Has anyone faced the same problem and what was the solution?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
neo112
  • 1,703
  • 2
  • 17
  • 39

3 Answers3

49

You can update this references to the lastest version I found (now is 2.1.0):

Install-Package Microsoft.Owin -Version 2.1.0
Install-Package Microsoft.Owin.Security -Version 2.1.0

And make sure your Web.config have these binding redirects for version 2.1.0:

<configuration>
  <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.1.0.0" newVersion="2.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Or you can update this references to version 2.0.1:

Install-Package Microsoft.Owin -Version 2.0.1
Install-Package Microsoft.Owin.Security -Version 2.0.1

And make sure your Web.config have these binding redirects for version 2.0.1:

<configuration>
  <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.0.1.0" newVersion="2.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.1.0" newVersion="2.0.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
Akira Yamamoto
  • 4,685
  • 4
  • 42
  • 43
3

Perhaps you need a binding redirect in your .config

<configuration>
<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.0.2.0" newVersion="2.0.2.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>
</configuration>
Jim Bolla
  • 8,265
  • 36
  • 54
  • The problem was that the version 2.0.2.0 of Owin and Owin.Security could not be added for some reason, the PM wouldn't allow that. However I was able to get the solution to run by upgrading both the Owin and Owin.Security to 2.1.0.0. – neo112 Jan 29 '14 at 19:14
  • 1
    Didn't work for me, but the exception message changed: Could not load file or assembly 'Microsoft.Owin' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) – Akira Yamamoto Jan 30 '14 at 16:38
1

In my case when I hosted my WCF service that has SignalR functionality in IIS and when I go to my IIS manager and to my application where I hosted my service right click svc file and click Browse, I was getting this error. So I did the following

In my Visual Studio, Tools -> Library Package Manager -> Package Manager Console

I made sure I selected my Website project that hosted my WCF service and gave below two commands one after another

uninstall-package Microsoft.AspNet.SignalR

install-package Microsoft.AspNet.SignalR

After this I just re-build my solution. Went to IIS manager and to my application where I hosted my service right click svc file and click Browse, I was able to see my service running in IE.

Akira Yamamoto
  • 4,685
  • 4
  • 42
  • 43
Ziggler
  • 3,361
  • 3
  • 43
  • 61
  • 1
    Worked for me, although not using WCF. Puzzled why you install and then uninstall. I assumed it was a typo but realised it wasn't there to begin within. – Chris Mar 05 '15 at 11:21