'/twtocn' 應用程式中發生伺服器錯誤。

遠端主機已強制關閉一個現存的連線。

描述: 在執行目前 Web 要求的過程中發生未處理的例外狀況。請檢閱堆疊追蹤以取得錯誤的詳細資訊,以及在程式碼中產生的位置。

例外狀況詳細資訊: System.Net.Sockets.SocketException: 遠端主機已強制關閉一個現存的連線。

原始程式錯誤:


行 201:                    Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(sTobody), HttpWebRequest)
行 202:                    ' Sends the request and waits for a response.
行 203:                    Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
行 204:                    If myHttpWebResponse.StatusCode = HttpStatusCode.NotFound Then
行 205:                        Response.write("查無頁面")

原始程式檔: D:\web2021\twtocn\Default_post.aspx.vb    行: 203

堆疊追蹤:


[SocketException (0x2746): 遠端主機已強制關閉一個現存的連線。]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +226

[IOException: 無法從傳輸連接讀取資料: 遠端主機已強制關閉一個現存的連線。。]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +811
   System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) +48
   System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +228
   System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +361
   System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) +233
   System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) +806
   System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +370
   System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) +21
   System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) +85
   System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) +1131
   System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) +62
   System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) +124
   System.Net.ConnectStream.WriteHeaders(Boolean async) +491

[WebException: 基礎連接已關閉: 傳送時發生未預期的錯誤。]
   System.Net.HttpWebRequest.GetResponse() +1751
   _Default_post.Page_Load(Object sender, EventArgs e) in D:\web2021\twtocn\Default_post.aspx.vb:203
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


版本資訊: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.8.4330.0