I have a WCF service that consumes a Web Service (developed in Java) where I need to connect to HTTPS using a certificate. So far everything works fine, however, in production environment my client uses a proxy and I am not able to establish an SSL connection through the proxy.
My Binding of the web.config of the development environment (which works) looks like this:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="DOCeManagerServiceSoap12Binding">
<textMessageEncoding messageVersion="Soap12"/>
<httpsTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://example.com.br:443/DFeWeb/services/DOCeManagerService.DOCeManagerServiceHttpsSoap12Endpoint/"
behaviorConfiguration="TestServiceBehavior" binding="customBinding"
bindingConfiguration="DOCeManagerServiceSoap12Binding" contract="DOCeManagerService.DOCeManagerServicePortType"
name="DOCeManagerServiceHttpsSoap12Endpoint">
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="TestServiceBehavior">
<clientCredentials>
<clientCertificate findValue="01FE53"
storeName="TrustedPublisher"
storeLocation="LocalMachine"
x509FindType="FindBySerialNumber"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
In the production environment I tried to modify this point only:
<httpsTransport bypassProxyOnLocal="true" proxyAddress="http://proxy.example.corp:8080" useDefaultWebProxy="false" >
I get the following error:
Could not establish trust relationship for SSL / TLS secure channel with authority 'subdomain.example.com'. The underlying connection was closed: Could not establish trust relationship for SSL / TLS secure channel. The remote certificate is invalid according to the validation procedure . "
I have tried numerous configurations but none of them solved my problem.
Update 1: I was thinking that the problem was related to the fact that I am making an SSL connection through a proxy that does not support SSL, but if I carry my code to console and inform the proxy to connect and consume the method. In this way, I did not understand how I was able to connect to SSL through an http proxy through the AppConsole and not WCF. Any ideas?
Update 2: On colleagues' recommendation I tried to run the service on IIS with my own user (same as I got SSL connection through AppConsole), but I do not know if I did it right or if something is missing, the service is unavailable ( Service Unavailable ). If someone has already done this and can help me it would be of good benefit to eliminate the possibility.
Update 3: I have updated the error message I get when I try to connect by adding the InnerException. When it says "The remote certificate is invalid according to the validation procedure." Does this refer to the server that I am consuming the service?