无法导入wsdl:portType,wsdl:binding,wsdl:port

Pra*_*ngh 18 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.
Run Code Online (Sandbox Code Playgroud)

一切都工作正常,直到我在数据合同中添加枚举成员.

小智 13

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

svcutil.exe service.wsdl

代替

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

仅供参考,我们正在将java Web服务集成到我们的wcf服务/ .net客户端.

  • 是的,这是完全可能的。从来没有想过传递 xsd 的方面,因为我使用 .Net & WCF 分层 xsd 作为 DataContracts 与 .net POCO 类的类兼容。+1 表示添加的场景。 (2认同)

Pra*_*ngh 2

结果是,我们DataContract在生成代理时重用,旧的 DataContract dll 没有在引用的位置被替换。

还可以从以下问题的响应中获取帮助:what-does-this-wcf-error-mean-custom-tool-warning-cannot-import-wsdlporttype?