First of all, apologies if my english is not quite correct.
I'm having a problem with the TLS protocol in the Azure cloud.
When I try to make a request to an external web service of the Spanish Tax Agency, it returns the following message: The request was cancelled: A secure SSL/TLS channel could not be created.
Testing in a local environment, I solved this with the following statement: System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
But the same source code doesn't work in the Azure AppService.
How do I force the protocol for Azure?
I don't have access to a client environment, only the azure portal.
AppService - ASP.NET 4.8 FrameWork 4.5.2
Modify the value of the Web.Config targetFramework field to 4.7.2, but no changes
Thanks for the comments @jdweng
To resolve this, try to upgrade TLS version of your app service manually:
Go to your
Web App=>settings=>configuration=>General Settings=> Select TLS 1.2as shown below:Web.Config:
Note:
.NET Framewok 4.7 (or) later versions uses the OS settings to determine the default security protocol for SSL/TLS connections.
As mentioned in the official MSDOC, it is not best practice to hard code and specify TLS version in .NET framework application.