c# - WebService客户端异常: Cannot Import wsdl:binding

标签 c# .net wcf web-services compiler-errors

我在 WebService Client 程序中收到以下错误/警告。

有人告诉我,如果我从我的 web.config 中删除协议(protocol),例如 HTTP/GET 和 HTTP/POST,它应该可以工作。但我使用的是 Windows 窗体。

如何在 Windows 窗体中执行相同的操作?

Warning 1 Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpGet'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 2 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpGet']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:service[@name='country']/wsdl:port[@name='countryHttpGet'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 3 Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpPost'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 4 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpPost']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:service[@name='country']/wsdl:port[@name='countryHttpPost'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

最佳答案

如果您想使用 svcutil 生成服务代理,您必须删除与 http://schemas.xmlsoap.org/wsdl/http 相关的所有内容以 http 为前缀的命名空间。因此,您需要删除两个绑定(bind)到 Web 服务端口。在这种情况下,您也不需要两种端口类型和多种消息类型。

关于c# - WebService客户端异常: Cannot Import wsdl:binding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4295224/

相关文章:

c# - 何时使用接口(interface)类型的变量而不是具体类型

c# - 将对象实例写入 C# 的工具(用于单元测试)

javascript - 从 html 调用 wcf 服务总是转到错误函数。与 aspx 页面一起正常工作

.net - 将 protobuf-net 添加到我的 WCF Rest 服务

c# - 从 wsdl 生成 c# 类

c# - 在 LINQ 中查找 2 列的乘积之和

c# - 在 .NET 4.5.2 控制台应用程序中使用 .NET Core 库

c# - 为 Silverlight 4.0 客户端全局设置文化

.net - 应用程序设置与属性设置

.net - 即使所有线程都在休眠,多核处理器也会 Hook