c# - 无法导入 wsdl :portType, wsdl :binding, wsdl:端口

标签 c# asp.net wcf proxy svcutil.exe

我在使用 SVCUtil 为 WCF 生成代理时遇到错误。错误是

Attempting to download metadata from 'net.pipe://localhost/WebServices/Mgmt.svc' using WS-Metadata Exchange. This URL does not support DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'SearchCriteria, Service.DataContracts, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null
t be used since it does not match imported DataContract. Need to exclude this type from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMgmt']


Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMgmt']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='NetNamedPipeBinding_IMgmt']


Error: 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://tempuri.org/']/wsdl:binding[@name='NetNamedPipeBinding_IMgmt']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='Mgmt']/wsdl:port[@name='NetNamedPipeBinding_I


Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.

一切正常,直到我在数据协定中添加一个枚举成员。

最佳答案

其他问题可能是没有将所有 XSD 传递给 svcutil。我们的问题是我们正在使用

svcutil.exe service.wsdl

代替

svcutil.exe service.wsdl first.xsd second.xsd ......

仅供引用,我们正在将 java web 服务集成到我们的 wcf 服务/.net 客户端。

关于c# - 无法导入 wsdl :portType, wsdl :binding, wsdl:端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18786373/

相关文章:

c# - 如何将 ExpandoObject 的字典设置为不区分大小写?

c# - GridView中LinkBut​​ton的行索引

c# - 如果不为空,检查查询字符串参数值的最优雅方法?

asp.net - 何时在 ASP.NET 页面上自动调用 DataBind?

c# - inetsvr 的 appcmd 在发出后发出错误

c# - Azure 表存储 key 延迟变化很大

c# - TransactionScope 回滚可以与 Selenium 或 Watin 一起使用吗?

c# - 将数据表复制为另一个数据表中的列

.NET 客户端使用 AXIS 1.4 SSL Webservice 所有异常 "INTERNAL SERVER ERROR"

.net - WCF:我应该如何维护客户端和服务器中的契约(Contract)类?