Angelo
Angelo

Reputation: 121

Force WCF to accept only TLS12 protocol

I have a WCF target on framework 4.5 and hosted on IIS (windows server 2012), calling the service from c# client with all the security protocols (SSL, TLS, TLS12) is working properly, is it possible to set the WCF service to accept only the TLS12 security protocol?

Upvotes: 0

Views: 491

Answers (1)

Abraham Qian
Abraham Qian

Reputation: 7522

According to official document guidance.
https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls
We had better not specify the TLS version, it is advisable to let the OS decide on the TLS version.
We could specify the TLS version by the below code on the client-side, provided that the operation system and project’s runtime environment meet the requirement. For more details, please refer to the above link.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient();

Feel free to let me know if there is anything I can help with.

Upvotes: 1

Related Questions