Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. in c# web api

I’m unable to get the access token and getting “Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.” error. using the same provided code with .net integration after replacing the key values. please help me to get out.

Makes sure you are using Tls1.2, I vaguely remember have to change this a few months ago
public ActionResult Callback(string code)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
if (!string.IsNullOrEmpty(code))
{