询问者
http请求时偶尔报System.AccessViolationException错,然后导致程序crash

问题
-
程序在进行http请求时偶尔会遇到下面的错误,导致程序crash,不知道是什么问题引起的,怎么样去修复,谢谢
日志名称: Application
来源: .NET Runtime
日期: 2016/3/15 22:19:53
事件 ID: 1026
任务类别: 无
级别: 错误
关键字: 经典
用户: 暂缺
计算机: iZ11hbel4f2Z
描述:
Application: dah.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Net.UnsafeNclNativeMethods+OSSOCK.WSAConnect(IntPtr, Byte[], Int32, IntPtr, IntPtr, IntPtr, IntPtr)
at System.Net.Sockets.Socket.DoConnect(System.Net.EndPoint, System.Net.SocketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean, System.Net.Sockets.Socket, System.Net.Sockets.Socket, System.Net.Sockets.Socket ByRef, System.Net.IPAddress ByRef, ConnectSocketState, System.IAsyncResult, System.Exception ByRef)
at System.Net.ServicePoint.GetConnection(System.Net.PooledStream, System.Object, Boolean, System.Net.IPAddress ByRef, System.Net.Sockets.Socket ByRef, System.Net.Sockets.Socket ByRef)
at System.Net.PooledStream.Activate(System.Object, Boolean, System.Net.GeneralAsyncDelegate)
at System.Net.Connection.CompleteStartConnection(Boolean, System.Net.HttpWebRequest)
at System.Net.Connection.CompleteStartRequest(Boolean, System.Net.HttpWebRequest, System.Net.TriState)
at System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean)
at System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String)
at System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint)
at System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef)
at System.Net.HttpWebRequest.GetRequestStream()
at CarPlateSHTest.Logical.HttpServer.HttpPost(System.String, System.String)
at CarPlateSHTest.Logical.WebApi.PostOcrResult(System.String, System.String, System.String, System.String, Int64)
at CarPlateSHTest.IdCode.ApolloOCR+<>c__DisplayClass3_0.<OCR>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
事件 Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2016-03-15T14:19:53.000000000Z" />
<EventRecordID>7585</EventRecordID>
<Channel>Application</Channel>
<Computer>iZ11hbel4f2Z</Computer>
<Security />
</System>
<EventData>
<Data>Application: dah.exe
Framework Version: v4.0.30319
Description:
The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at System.Net.UnsafeNclNativeMethods+OSSOCK.WSAConnect(IntPtr, Byte[], Int32, IntPtr, IntPtr, IntPtr, IntPtr)
at System.Net.Sockets.Socket.DoConnect(System.Net.EndPoint, System.Net.SocketAddress)
at
System.Net.ServicePoint.ConnectSocketInternal(Boolean, System.Net.Sockets.Socket, System.Net.Sockets.Socket, System.Net.Sockets.Socket ByRef, System.Net.IPAddress ByRef, ConnectSocketState, System.IAsyncResult, System.Exception ByRef)
at System.Net.ServicePoint.GetConnection(System.Net.PooledStream, System.Object, Boolean, System.Net.IPAddress ByRef, System.Net.Sockets.Socket ByRef, System.Net.Sockets.Socket ByRef)
at System.Net.PooledStream.Activate(System.Object, Boolean, System.Net.GeneralAsyncDelegate)
at System.Net.Connection.CompleteStartConnection(Boolean, System.Net.HttpWebRequest)
at System.Net.Connection.CompleteStartRequest(Boolean, System.Net.HttpWebRequest, System.Net.TriState)
at System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean)
at System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String)
at System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint)
at System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef)
at System.Net.HttpWebRequest.GetRequestStream()
at CarPlateSHTest.Logical.HttpServer.HttpPost(System.String, System.String)
at CarPlateSHTest.Logical.WebApi.PostOcrResult(System.String, System.String, System.String, System.String, Int64)
at CarPlateSHTest.IdCode.ApolloOCR+<>c__DisplayClass3_0.<OCR>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</Data>
</EventData>
</Event>
全部回复
-
您好,
上面的错误信息是一个很大概的错误信息,你是使用wcf服务么?如果是的话,你看看配置tracing能不能帮助您找到更多的有用信息.
https://msdn.microsoft.com/zh-cn/library/ms733025%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 .
另外要是方便的话,你可以给我们一个可以重现你问题的程序么?Thanks.
---Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.