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

后端 未结 2 1670
慢半拍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.

提交回复
热议问题