タイムアウトの問題があります。私が接続しているサービスは、タイムリーに応答すると正常に動作します。10秒くらいかかると例外でタイムアウト。Timeout と ReadWriteTimeout 以外に、適切に待機するために設定できるタイムアウト プロパティは何ですか? TCP/IP レベルで設定する必要があるものはありますか? ご協力いただきありがとうございます。
System.Net.WebException: 基になる接続が閉じられました: 接続が予期せず閉じられました。System.Net.HttpWebRequest.GetResponse() で
これが私のコードです。私は多くのバリエーションを試しました:
'The post works
Dim _httpRequest As HttpWebRequest
_httpRequest = WebRequest.Create("mywebservice")
System.Net.ServicePointManager.Expect100Continue = False
_httpRequest.Credentials = CredentialCache.DefaultCredentials
_httpRequest.ProtocolVersion = HttpVersion.Version10
'This is a 60 second wait
_httpRequest.Timeout = 60000
'This is a 60 second wait
_httpRequest.ReadWriteTimeout = 60000
_httpRequest.KeepAlive = False
_httpRequest.Method = "POST"
'If the response takes takes 10 seconds
'This is the message we get: System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
_httpRequest.Method = "GET"
_httpRequest.ContentType = "text/xml"
'The error is here
Dim httpResponse As HttpWebResponse = _httpRequest.GetResponse