我正在使用VS 2013构建一个winform客户端。我想使用3方Java安全和外部(使用带证书的https)Web服务。
我可以访问wsdl。我在引用端点地址的.net项目中添加了一个服务引用,并使用wsHttpBinding和transport配置了我的web.config。 (我也尝试过basicHttpBinding)
在代码中,我创建了一个客户端服务对象,我可以正常看到它的方法和数据类型。
我已经看到,只要我创建对象,InnerChannel属性就处于故障状态模式,我不明白为什么。
问题是当调用任何服务对象方法时,它会给出错误:
类型'System.InvalidOperationException'的未处理异常 发生在System.Xml.dll
中 发生了'System.ServiceModel.CommunicationObjectFaultedException' System.ServiceModel.dll附加信息:通信对象, System.ServiceModel.ChannelFactory`1 [myproyect.SR.NotificaWsPortType],不能用于通讯 因为它处于Faulted状态。
其他信息:反映“退货”的错误。
有人能帮助我吗?
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>
答案 0 :(得分:0)
我终于找到了答案。在.NET中映射Web服务时出现问题,因为Web服务是用Java开发的,并且在Microsoft技术方面存在问题。 因此,我与服务提供商进行了交谈,他们对.net的Java并没有任何问题。他们改变了内部结构,对我有用。