wcf - 使用 Microsoft.Data.Services.Client.dll 而不是 System.Data.Services.Client.dll 会导致 Azure.StorageClient 出现问题

标签 wcf azure odata

我们有一个使用 WCF 5.0 和 WindowsAzure SDK 的项目。

有两个引用 Microsoft.Data.Services.Client.dll 和 System.Data.Services.Client.dll,它们存在冲突。如果我删除系统 DLL(按照 this ),我将无法使用 windowsAzure SDK。如果删除 Microsoft DLL,我将无法利用 WCF 特别是 OData 3.0 版的新功能。

删除系统 DLL 引用后:

cannot convert from 'System.Data.Services.Client.SaveChangesOptions [c:\Program Files (x86)\Microsoft WCF Data Services\5.0\bin.NETFramework\Microsoft.Data.Services.Client.dll]' to 'System.Data.Services.Client.SaveChangesOptions'

其他信息:

The best overloaded method match for 'Microsoft.WindowsAzure.StorageClient.TableServiceContext.SaveChangesWithRetries(System.Data.Services.Client.SaveChangesOptions)' has some invalid arguments

The type 'System.Data.Services.Client.DataServiceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

如果我删除对 Microsoft.Data.Services.Client 的引用并添加对 System.Data.Services.Client 的引用,那么我们不会收到任何错误 - 我们也不会收到 WCF 5.0!

最佳答案

我能够相当快地重现这个问题。 Microsoft.WindowsAzure.StorageClient.Dll 对 System.Data.Service.Client.Dll 具有直接引用依赖性,如下所示,因此如果要使用 Azure 存储客户端 API,则必须引用 System.Data.Service.Client.Dll在您的应用程序中,并确保您不能使用 WCF 5.0 SDK 提供的 oData 3.0。更多信息发布在下面的问题中:

WCF 5.0 and oData 3.0 API not work with azure table storage

关于wcf - 使用 Microsoft.Data.Services.Client.dll 而不是 System.Data.Services.Client.dll 会导致 Azure.StorageClient 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10675104/

相关文章:

azure - 如何实现 ARM 模板的测试用例

javascript - sap.m.树实现

c# - 嵌套 $expands 的 Asp.net WebApi OData V4 问题

c# - 如何在 ASP.NET Core 3.1 上运行的启用 OData 的 Web API 中添加 Swagger

c# - 所有 IP 地址上的 Mono 和 WCF Net.Tcp 绑定(bind)

c# - Service Fabric Owin 管道中的 WsFederation 身份验证不起作用

c# - Windows Azure 上的 Crystal 报表未显示

c# - 从 multipart/form-data POST 读取文件输入

c# - WCF 测试客户端服务调用失败

wcf - WCF 可靠 session 的问题(可靠消息传递)