与目标服务的SOAP安全协商失败

时间:2015-11-06 10:47:38

标签: c# .net web-services wcf soap

我从.NET客户端调用外部Web服务。主机使用自签名证书,他们说我不需要安装任何证书来拨打他们的服务。

我的所有客户端和服务配置都在我的app.config文件中,因此我创建了没有任何绑定或端点地址作为参数的客户端。我也使用服务参考。

static void Main(string[] args)
    {

        ServiceReference.BgLinkServiceClient client = new ServiceReference.BgLinkServiceClient();

        ServiceReference.LogonRequest request = new ServiceReference.LogonRequest();
        ServiceReference.LogonResponse lg = new ServiceReference.LogonResponse();

        Console.WriteLine("Attempting to connect to the Service...");
        lg = client.Logon(request);
    }

我的app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="MessageTransportBehavior">
      <clientCredentials>
        <serviceCertificate>
          <authentication certificateValidationMode="None" revocationMode="NoCheck"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <customBinding>
    <binding name="CustomBinding_IBgLinkService">
      <reliableSession />
      <security defaultAlgorithmSuite="Basic256Sha256" authenticationMode="SecureConversation"
          requireDerivedKeys="true" includeTimestamp="true" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
          requireSignatureConfirmation="false" canRenewSecurityContextToken="true">
        <secureConversationBootstrap defaultAlgorithmSuite="Basic256Sha256"
            authenticationMode="AnonymousForSslNegotiated" requireDerivedKeys="true"
            includeTimestamp="true" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
            requireSignatureConfirmation="true">
          <localClientSettings detectReplays="true" />
          <localServiceSettings detectReplays="true" />
        </secureConversationBootstrap>
        <localClientSettings detectReplays="true" />
        <localServiceSettings detectReplays="true" />
      </security>
      <textMessageEncoding />
      <httpsTransport />
    </binding>
  </customBinding>
</bindings>
<client>
  <endpoint 
      address="https://www.bt.bglinkws.bgonline.se/WebService/BgLinkService.svc"
      binding="customBinding" 
      bindingConfiguration="CustomBinding_IBgLinkService"
      contract="ServiceReference.IBgLinkService" 
      name="CustomBinding_IBgLinkService">
    <identity>
      <dns value="www.bt.bglinkws.bgonline.se" />
    </identity>
  </endpoint>
</client>
</system.serviceModel>
</configuration>

我收到此错误: 与&#39; https://www.bt.bglinkws.bgonline.se/WebService/BgLinkService.svc&#39;进行SOAP安全协商对于目标&#39; https://www.bt.bglinkws.bgonline.se/WebService/BgLinkService.svc&#39;失败。

内部例外: {&#34; X.509证书CN = www.bt.bglinkws.bgonline.se,OU = ITS,O = Bankgirocentralen BGC AB,C = SE链建设失败。使用的证书具有无法验证的信任链。替换证书或更改certificateValidationMode。撤销功能无法检查吊销,因为吊销服务器处于脱机状态。\ r \ n&#34;}

可以在这里使用一些帮助,一直在努力解决这个问题。

0 个答案:

没有答案