【发布时间】:2017-03-06 09:26:57
【问题描述】:
我正在使用 VS 2013 构建一个 winform 客户端。我想使用 3party java 安全和外部(使用带有证书的 https)Web 服务。
我可以访问 wsdl。我向我的 .net 项目添加了一个服务引用,引用了 Endpoint 的地址,并使用 wsHttpBinding 和传输配置了我的 web.config。 (我也尝试过 basicHttpBinding )
在代码中,我创建了一个客户端服务对象,我可以正常看到它的方法和数据类型。
我看到我一创建对象,InnerChannel 属性就处于故障状态模式,我不明白为什么。
问题是在调用任何服务对象方法时,都会报错:
“System.InvalidOperationException”类型的未处理异常 发生在 System.Xml.dll 中
“System.ServiceModel.CommunicationObjectFaultedException”发生在 System.ServiceModel.dll
附加信息:通信对象, System.ServiceModel.ChannelFactory`1 [myproyect.SR.NotificaWsPortType],不能用于通讯 因为它处于故障状态。
附加信息:出现反映“返回”的错误。
谁能帮帮我?
web.config 文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NotificaWsBinding">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://<address here>"
binding="wsHttpBinding" bindingConfiguration="NotificaWsBinding"
contract="SR.NotificaWsPortType" name="NotificaWsPort" />
</client>
</system.serviceModel>
</configuration>
【问题讨论】:
-
我配置了...wsHttpBinding 和传输 - 您不应该使用此绑定,因为它不可互操作。请改用 basicHttpBinding。这应该在您使用服务元数据时为您选择。
-
感谢您的回复。最初我使用 basicHttpBinding 但它也不起作用。我仍然有同样的问题。
标签: wcf