简体   繁体   中英

This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. c#

Maybe this question already has but I think there is a different situation. I configure all required things from the web config file and install certificates.

I consume java web service in ASP.NET WEB API. SOAP service was configured mutual authentication. (Two-way SSL) I have 2 Keystore files. (client.jks and truststore.jks)

My full error: This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.'

WebConfig:

<customBinding>
        <binding name="MyBinding">
          <textMessageEncoding messageVersion="Soap11"/>
          <security authenticationMode="MutualCertificate" enableUnsecuredResponse="true" allowSerializedSigningTokenOnReply="true"
                    messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
                    includeTimestamp="false">
          </security>
          <httpsTransport />
        </binding>
</customBinding>


<endpoint behaviorConfiguration="ClientCredentialsBehavior" address="https://abc.bank.dm:9193/Money/Money" binding="customBinding" bindingConfiguration="MyBinding" contract="Ref.Port" name="Port">
        <identity>
          <dns value="test"/>
        </identity>
</endpoint>


<behaviors>
      <endpointBehaviors>
        <behavior name="ClientCredentialsBehavior">
          <clientCredentials>
            <clientCertificate findValue="2d73n94087857dndyr874ydr"
                 storeLocation="CurrentUser"
                 storeName="My"
                 x509FindType="FindByThumbprint" />
            <serviceCertificate>
              <defaultCertificate findValue="d346n32d48938w43d943095d"
                                  storeLocation="CurrentUser"
                                  storeName="TrustedPeople"
                                  x509FindType="FindByThumbprint" />
              <authentication certificateValidationMode="None" revocationMode="NoCheck"/>

            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
</behaviors>

Try to specify the same protocol on the client and server. Add the following code in the client:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

Here is the reference: TLS 1.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM