我發佈了賞金和upvoted堰的答案,但沒有足夠的分數留下評論。無論如何,我們編寫了一個測試程序來直接調用GetResponse(),並在服務器上崩潰。除了更新Windows和一般的任何服務器代碼外,所有堰的要點都不適用,所以我想公平地接受他的回答,以便得到賞金,但不知道如何。發佈下面的代碼,以便任何人都可以在他們的盒子上更容易地重現問題,如果它發生在他們身上。
Imports System.IO
Imports System.Net
Partial Class TestWebRequest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim request As HttpWebRequest = CType(WebRequest.Create("https://en.wikipedia.org"), HttpWebRequest)
request.Timeout = 30000
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = response.GetResponseStream()
Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
webRequestResponse.Text = "Result: " + readStream.ReadToEnd() + Environment.NewLine
response.Close()
readStream.Close()
Catch ex As Exception
webRequestResponse.Text = "Error Message: " + ex.ToString()
End Try
End Sub
End Class
什麼是您的項目的目標平臺? –
項目的目標平臺是「任何CPU」 – prateek