简体   繁体   English

WCF 异步 Web 服务问题

[英]WCF Async Web Services issues

I'm having several issues with my WCF client in that the client Reference.cs is empty and the only error I get on the build is the useless generic message:我的 WCF 客户端有几个问题,客户端 Reference.cs 是空的,我在构建中遇到的唯一错误是无用的通用消息:

Severity Code Description Project File Line Suppression State Warning Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: The located assembly's manifest definition does not match the assembly reference.严重性代码描述项目文件行抑制状态警告自定义工具警告:无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:找到的程序集的清单定义与程序集不匹配参考。 (Exception from HRESULT: 0x80131040) XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IBrokerWcf'] MyWeb.Setup C:\Users\me\Projects\MyWeb 3.x\MyWeb v3.x\MyWeb.Setup\Service References\BrokerWcfSvc\Reference.svcmap 1 (来自 HRESULT 的异常:0x80131040)到错误源的 XPath://wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IBrokerWcf'] MyWeb.Setup C:\ Users\me\Projects\MyWeb 3.x\MyWeb v3.x\MyWeb.Setup\Service References\BrokerWcfSvc\Reference.svcmap 1

When I load the Service in the WCF Test Client, all of the advertised async methods error out (see image) with "This Operation is not supported in the WCF Test Client because it uses type System.Threading.Tasks.Task'1"当我在 WCF 测试客户端中加载服务时,所有广告的异步方法都会出错(参见图片),并显示“WCF 测试客户端不支持此操作,因为它使用类型 System.Threading.Tasks.Task'1”

All of this previously worked fine.所有这些以前都运行良好。 Not sure what changed to send it all sideways.不知道发生了什么变化以将其全部横向发送。

WCF 测试客户端

System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: The located assembly's manifest definition does not match the assembly reference. System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:找到的程序集的清单定义与程序集引用不匹配。

As the error says, the manifest definition of the locating assembly does not match the assembly reference.正如错误所说,定位程序集的清单定义与程序集引用不匹配。 You need to check the components.您需要检查组件。 Did you click "Reuse types in referenced assemblies" when adding a service reference.添加服务引用时是否单击“在引用的程序集中重用类型”。

This Operation is not supported in the WCF Test Client because it uses type System.Threading.Tasks.Task'1" WCF 测试客户端不支持此操作,因为它使用类型 System.Threading.Tasks.Task'1"

The "error" you are seeing is just a limitation of the test tool that comes with visual studio, both functions call the same server side function so there is no compelling force to make Microsoft add support.您看到的“错误”只是 Visual Studio 附带的测试工具的一个限制,两个函数调用相同的服务器端函数,因此没有强制力让微软添加支持。 There is no actual error.没有实际错误。 If you really want to test the async version you will need to write your own test client that calls the function.如果您真的想测试异步版本,您将需要编写自己的测试客户端来调用该函数。
Error : not supported in WCF Test client because it uses type System.Threading.Tasks 错误:WCF 测试客户端不支持,因为它使用类型 System.Threading.Tasks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM