Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force by config to use tls 1.0 in a wcf client c#

We have a web app that has a client implemented with WCF. This client uses SSL_LVL3 to make the handshake with an external service. It turns out that the service just disabled the SSL_LVL3, so we need to change it to TLS 1.0. There is a way to force TLS security in C#:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

But it changes the security of all the services that are used by the app and not all the services accept TLS.

What we would like is to change the web.config to force the WCF service to use TLS. Is there any way to do this?

This is the binding of the service:

<binding name="XXXX" closeTimeout="00:01:00" openTimeout="00:01:00" 
    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"  
    bypassProxyOnLocal="false" NameComparisonMode= "StrongWildcard" 
    maxBufferPoolSize="524288" maxBufferSize="655360" 
    maxReceivedMessageSize="655360" textEncoding="utf-8"
    transferMode="Buffered" useDefaultWebProxy="true"  
    messageEncoding="Text">
    <security mode="Transport" />
 </binding>
like image 224
Energ888 Avatar asked Sep 21 '15 10:09

Energ888


1 Answers

<customBinding >
  <binding name="CusSoap">                  
       <sslStreamSecurity requireClientCertificate="true"   sslProtocols="Ssl3|Tls|Tls11|Tls12" />                    
        </binding>

But it is available in Visual Studio 2015(.Net Framework 4.5.2)

like image 108
Palash Avatar answered Sep 30 '22 16:09

Palash