Reference.svcmap:无法加载文件或程序集Microsoft.Practices.ServiceLocation,Version = 1.0.0.0

时间:2015-03-01 02:23:24

标签: asp.net web-services wcf unity3d

我有一个简单的webforms网站项目。该项目使用通过NuGet添加的Microsoft应用程序块 Unity 3.5 (DI容器)。

现在我正在使用第三方网络服务。在我添加服务参考和构建后,我得到了这个:

  

错误19 Reference.svcmap:无法加载文件或程序集   'Microsoft.Practices.ServiceLocation,Version = 1.0.0.0,   Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其中一个   依赖。定位程序集的清单定义没有   匹配程序集引用。 (HRESULT的例外情况:   0x80131040)App_WebReferences / MyExternalService /

所以我安装了Microsoft.Practices.ServiceLocation但它仍然在抱怨该程序集。

enter image description here

我尝试将此添加到我的web.config但仍然无效。

 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>

我卸载Unity软件包后,一切都很好。没有错误,我可以使用服务代理

尝试清洁构建等,但没有任何作用。

有什么想法吗?

1 个答案:

答案 0 :(得分:12)

我正在安装错误的软件包以获取对Microsoft.Practices.ServiceLocation

的引用

包装错误enter image description here

正确的包裹是: enter image description here

相关问题