我一直试图从一个简单的WCF控制台客户端连接到基于远程Jax的Web服务。关于此问题,已经花了几个小时来研究Stackoveflow。我看过很多文章并尝试了多种配置,但似乎没有任何效果。这是我的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="XyzGatewaySoapPortBinding">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://www.abcxyz.com/gateway/ws': -->
<!-- <wsdl:binding name='XyzGatewaySoapPortBinding'> -->
<!-- <ns0:SupportingTokens xmlns:ns0="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512">..</ns0:SupportingTokens> -->
<!-- <ns0:SupportingTokens xmlns:ns0="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512">..</ns0:SupportingTokens> -->
<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://www.abcxyz.com:443/gateway/ws"
binding="customBinding" bindingConfiguration="XyzGatewaySoapPortBinding"
contract="TestServiceReference.Gateway" name="GatewaySoapPort" />
</client>
</system.serviceModel>
</configuration>
很明显,这是来自不良WSDL的格式错误的配置文件(我使用 Add Service Reference 选项将其添加到VS2017中)。希望对解决此问题有任何见解。预先感谢!