无法加载文件或程序Microsoft

无法加载文件或程序Microsoft

本文介绍了SignalR 2.0错误:无法加载文件或程序Microsoft.Owin.Security的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面一步该教程一步

http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-signalr-20-self-host

和我得到的下方标示

        string url = "http://localhost:8080";
        using (WebApp.Start(url)) //<------ error on this line
        {
            Console.WriteLine("Server running on {0}", url);
            Console.ReadLine();
        }

错误消息:

无法加载文件或程序集Microsoft.Owin.Security,版本= 2.0.1.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040)

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

更多信息:

在我的项目解决方案,参考指向从的NuGet包文件夹中的DLL

In my project solution, the reference is pointing to the dll in the packages folder from NuGet

这已经在我的App.config文件被添加的NuGet

This has been added in my App.config file by NuGet

<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.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

在包文件夹,​​包\\ Microsoft.Owin.Security.2.0.0 \\ lib目录\\ net45 ,Microsoft.Owin.Security.dll的文件版本是2.020911 .395

In the packages folder, packages\Microsoft.Owin.Security.2.0.0\lib\net45, the file version of Microsoft.Owin.Security.dll is 2.020911.395

推荐答案

好吧,我已经解决了它。

Ok I've solved it.

我有我的Microsoft.Owin.Security包升级到2.1.0使用这个命令

I had to upgrade my Microsoft.Owin.Security package to 2.1.0 with this command

Install-Package Microsoft.Owin.Security -Version 2.1.0

和修改绑定在我的App.config这样

And modify the bindings in my App.config like this

<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />

这篇关于SignalR 2.0错误:无法加载文件或程序Microsoft.Owin.Security的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:38