Http post error: An existing connection was forcibly closed by the remote host

后端 未结 2 1658
慢半拍i
慢半拍i 2020-12-10 13:45

I realise there have been a number of similar posts to this but I haven\'t found a solution yet. Am trying to post some xml to an MPI gateway but keep getting the following

相关标签:
2条回答
  • 2020-12-10 14:13

    I think its because you are connecting to "https" url. In this case you have to add following line to your code.

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    It will accept "ssl" protocol for your request. "ServicePointManager.ServerCertificateValidationCallback" handler just controls certificate validity.

    0 讨论(0)
  • 2020-12-10 14:22

    Slightly better perhaps:

    System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol | System.Net.SecurityProtocolType.Tls12;
    
    0 讨论(0)
提交回复
热议问题