0

I create a webService to generate pdf file. In debug mode with VisualStudio 2012. It's Ok. I can call it from other IntranetSite.

I try to put it on my test server. But I need to add https instead of http.

I find this I try to adapted like this my web.config

<system.serviceModel>
<bindings>
  <basicHttpBinding>
      <binding name="GenerationCourriersSoap" >
          <security mode="Transport">
              <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
              <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
      </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
<behavior name="secureBehaviours">
  <serviceMetadata httpsGetEnabled="true"/>
</behavior>
 </serviceBehaviors>
</behaviors>
 <client>
<endpoint address="https://localhost:52999/GenerationCourrier.asmx"
binding="basicHttpBinding" bindingConfiguration="GenerationCourriersSoap"
contract="WSCourrier.GenerationCourriersSoap" name="GenerationCourriersSoap"    />
</client>
</system.serviceModel>

But I've message

Unable to establish a trust for the secure channel SSL / TLS with authority 'localhost: 52999'.

I used an auto-certicate buid by IIS directly. I verify, this certificate is on my root and secure folder Someone have an idea?

Community
  • 1
  • 1
YannickIngenierie
  • 602
  • 1
  • 13
  • 37

1 Answers1

0

Finally I find this enter link description here

It seems good. now I can reach the webService.

The Idea is to force the validation of all certificate. Just the time of test period like that

Imports System
Imports System.Net
Imports System.Security.Cryptography.X509Certificates

Public Class clsSSL
    Public Function AcceptAllCertifications(ByVal sender As Object, ByVal certification As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
        Return True
    End Function
End Class

And call function just before call WebService function

ServicePointManager.ServerCertificateValidationCallback = AddressOf AcceptAllCertifications
Community
  • 1
  • 1
YannickIngenierie
  • 602
  • 1
  • 13
  • 37