【问题标题】:Visual Studio 2015 System.Net.HttpWebRequest System.IO.IOException while Debug Run but Not via Compiled EXEVisual Studio 2015 System.Net.HttpWebRequest System.IO.IOException,而调试运行但不是通过编译的 EXE
【发布时间】:2019-05-30 09:33:14
【问题描述】:

2019 新年在我下面的 Visual Studio 2015 代码中带来了这个调试异常。唯一可行的是运行已编译的 EXE 或使用具有相同 Internet 第三方 API 调用的 Visual Studio 2010。我们已经安装了更新的 Symantec Endpoint Protection,我们进行了各种调整,但周日无济于事。我的同事卸载了赛门铁克,我们都多次重新启动,但都没有缓解。

2019-01-03 08:56:47.3326|ERROR|...:
The underlying connection was closed: An unexpected error occurred on a send. --->
System.IO.IOException: Unable to read data from the transport connection: 
An existing connection was forcibly closed by the remote host. ---> 
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.TlsStream.CallProcessAuthentication(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean reserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)

---内部异常堆栈跟踪结束---

at System.Net.HttpWebRequest.GetResponse()

【问题讨论】:

  • 附加到正在运行的 EXE 确实提供了一种解决方法。
  • 从VS内部打开EXE文件,然后“开始调试”不起作用。

标签: windows debugging exception visual-studio-2015 symantec


【解决方案1】:

问题开始的同一天是我们的第三方 Web API 提供商停止支持 TLS 1.0 的同一天。据我了解 TLS,Windows 10 和 Visual Studio 2015 将默认为 TLS 1.0。快速修复是在第一个 API 调用之前使用此 VB.NET 代码: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

从长远来看,我们将消除每个 Microsoft 的 WebRequest 调用: "重要

我们不建议您使用 WebRequest 或其派生类进行新开发。而是使用 System.Net.Http.HttpClient 类。”

【讨论】:

    猜你喜欢
    • 2011-03-14
    • 1970-01-01
    • 2015-12-13
    • 2019-09-27
    • 1970-01-01
    • 2023-03-29
    • 2017-10-01
    • 1970-01-01
    • 2015-11-21
    相关资源
    最近更新 更多