GetRequestStream() is throwing time out exception when posting data to HTTPS url

前端 未结 5 1713
悲&欢浪女
悲&欢浪女 2021-02-07 06:34

I\'m calling an API hosted on Apache server to post data. I\'m using HttpWebRequest to perform POST in C#.

API has both normal HTTP and secure layer (HTTPS) PORT on the

5条回答
  •  爱一瞬间的悲伤
    2021-02-07 07:02

    I ran into the same issue. It seems like it is solved for me. I went through all my code making sure to invoke webResponse.Close() and/or responseStream.Close() for all my HttpWebResponse objects. The documentation indicates that you can close the stream or the HttpWebResponse object. Calling both is not harmful, so I did. Not closing the responses may cause the application to run out of connections for reuse, and this seems to affect the HttpWebRequest.GetRequestStream as far as I can observe in my code.

提交回复
热议问题