[英]Microsoft.Data.Services version issue while running WCF Data Services
I am getting the following error:我收到以下错误:
Could not load file or assembly 'Microsoft.Data.Services, Version=5.6.2.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)
But when I go and check my Packages.config:但是当我去检查我的 Packages.config 时:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net472" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net472" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net472" />
<package id="Microsoft.Data.Services" version="5.6.4" targetFramework="net472" />
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net472" />
<package id="Microsoft.OData.EntityFrameworkProvider" version="1.0.0-beta2" targetFramework="net472" />
<package id="System.Spatial" version="5.6.4" targetFramework="net472" />
</packages>
It showing me above file, Do I need to change the version ?它显示我上面的文件,我需要更改版本吗? If yes then how I can change it?
如果是,那么我该如何改变它? I tried through nugget it didn't work.
我尝试通过 nugget 它没有用。
I checked in my C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.9\\bin\\plugins\\Diagnostics
there are 5.6.2 version dlls are there, I replaced them with 5.6.4 but still getting the same error.我检查了我的
C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.9\\bin\\plugins\\Diagnostics
那里有 5.6.2 版本的 dll,我用 5.6.4 替换它们但仍然得到相同的错误。
Update:更新:
I updated below in my web.config:我在我的 web.config 中更新了以下内容:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.2.0" newVersion="5.6.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
It changes the output to:它将输出更改为:
Error: The server encountered an error processing the request.
错误:服务器在处理请求时遇到错误。 See server logs for more details
有关更多详细信息,请参阅服务器日志
This issue comes into picture whenever there is any issue at WCF service.每当 WCF 服务出现任何问题时,就会出现这个问题。 So see more details about the issue, you need to
includeexceptiondetailInfaults
attribute to true
in servicedebug
tag.因此,查看有关该问题的更多详细信息,您需要在
servicedebug
标记includeexceptiondetailInfaults
属性包含为true
。
<Service Behavior>
<Behavior Name="myServiceBehavior">
<servicedebug includeexceptiondetailinfaults="true" />
</Behavior>
</Service Behavior>
Either you can also add class attribute to the service class.您也可以将类属性添加到服务类。
Could not load file or assembly 'Microsoft.Data.Services, Version=5.6.2.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
无法加载文件或程序集“Microsoft.Data.Services, Version=5.6.2.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference.
定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)
(来自 HRESULT 的异常:0x80131040)
For this problem, first check what version of this dll you have in your output directory.Then对于这个问题,首先检查你的输出目录中这个dll的版本。然后
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.