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

Posted

技术标签:

【中文标题】无法导入 wsdl:portType、wsdl:binding、wsdl:port【英文标题】:Cannot import wsdl:portType, wsdl:binding, wsdl:port 【发布时间】:2013-09-18 03:28:30 【问题描述】:

使用 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.

在我在数据合约中添加枚举成员之前,一切正常。

【问题讨论】:

【参考方案1】:

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

svcutil.exe service.wsdl

而不是

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

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

【讨论】:

是的,这完全有可能。自从我为 DataContracts 使用 .Net 和 WCF 分层 xsd 以来,从未想过传递 xsd 的方面与 .net POCO 类的类兼容。为添加的场景 +1。【参考方案2】:

事实证明,我们在生成代理时重用了DataContract,并且旧的 DataContract dll 没有在它被引用的位置被替换。

还可以从有问题的回复中获得帮助 what-does-this-wcf-error-mean-custom-tool-warning-cannot-import-wsdlporttype?

【讨论】:

以上是关于无法导入 wsdl:portType、wsdl:binding、wsdl:port的主要内容,如果未能解决你的问题,请参考以下文章

ImportError:无法导入名称而无法导入类

我必须安装啥才能解决找不到 GtkSource 的任何类型库,无法导入:GtkSourceView,无法导入名称 GtkSource

mysql 表导入向导无法导入 csv 文件

导入 theano 时出错“无法导入名称 gof”

无法从'@angular/forms'导入“导入FormGroup,FormControl [重复]

无法在春季导入 org.apache.poi,因此无法编译