问题描述
我有旧的 wcf Web 服务,对于网络问题,我决定将服务 WSDL 保存在 XML 文件中,并在我的 AspCore 项目中调用 Localy 进行测试功能,但出现此错误:
无法导入 wsdl:port 详细信息:导入 wsdl:port 所依赖的 wsdl:binding 时出错。 到 wsdl:binding 的 XPath: //wsdl:deFinitions[@targetNamespace='http://est']/wsdl:binding[@name='EstelamPortBinding'] 错误源的 XPath://wsdl:deFinitions[@targetNamespace='http://est']/wsdl:service[@name='Estelam']/wsdl:port[@name='EstelamPort'] 无法导入 wsdl:binding 详细信息:导入 wsdl:binding 所依赖的 wsdl:portType 时出错。 wsdl:portType 的 XPath: //wsdl:deFinitions[@targetNamespace='http://est']/wsdl:portType[@name='EstelamPort'] 错误源的 XPath://wsdl:deFinitions[@targetNamespace='http://est']/wsdl:binding[@name='EstelamPortBinding'] 无法导入 wsdl:portType 详细信息:运行 WSDL 导入扩展时引发异常:System.ServiceModel.Description.DataContractSerializerMessageContractImporter 错误:找不到目标命名空间为“http://est”的架构。 错误源的 XPath://wsdl:deFinitions[@targetNamespace='http://est']/wsdl:portType[@name='EstelamPort']
注意:我在 XML 中将位置更改为本地地址
解决方法
虽然可以在.net core中调用WCF服务,但是会受到一些限制。 .net Core 中的 WCF 客户端仅支持四种绑定:BasicHttpBinding、CustomBinding、NetHttpBinding、NetTcpBinding,.net Core 中的安全特性并不多。
关于core对WCF的支持,可以参考这个链接: