I have a simple webforms website project. The project uses Microsoft Application Block Unity 3.5 (DI Container) added via NuGet.
我有一个简单的webforms网站项目。该项目使用通过NuGet添加的Microsoft Application Block Unity 3.5(DI Container)。
Now I am using this 3rd party web service. After I add Service Reference and build I get this:
现在我正在使用这个第三方Web服务。添加服务引用和构建后,我得到了这个:
Error 19 Reference.svcmap: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.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) App_WebReferences/MyExternalService/
错误19 Reference.svcmap:无法加载文件或程序集“Microsoft.Practices.ServiceLocation,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)App_WebReferences / MyExternalService /
So I installed Microsoft.Practices.ServiceLocation but it still keeps complaining about that assembly.
所以我安装了Microsoft.Practices.ServiceLocation但它仍然在抱怨该程序集。
I tried adding this to my web.config but still doesn't work.
我尝试将此添加到我的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>
As soon as I uninstall Unity package, all is good. No errors and I can use the Service proxy
一旦我卸载Unity软件包,一切都很好。没有错误,我可以使用服务代理
Tried Clean Build, etc. but nothing works.
尝试清洁构建等,但没有任何作用。
Any idea?
1 个解决方案
#1
12
I was installing wrong package for getting reference to Microsoft.Practices.ServiceLocation
我正在安装错误的软件包以获取对Microsoft.Practices.ServiceLocation的引用
Wrong package:
Correct package is:
正确的包装是:
#1
12
I was installing wrong package for getting reference to Microsoft.Practices.ServiceLocation
我正在安装错误的软件包以获取对Microsoft.Practices.ServiceLocation的引用
Wrong package:
Correct package is:
正确的包装是: