WebRequest中的堆栈缓冲区溢出原因

时间:2018-07-24 03:26:04

标签: c# asp.net iis .net-4.7.2

大约3-4周前,我们开始在网络服务器上遇到间歇性问题。此问题发生了2-3次,每次0xc0000409的事件查看器中都出现相同的错误。

Faulting application name: w3wp.exe, version: 10.0.14393.0, time stamp: 0x57899b8a
Faulting module name: clr.dll, version: 4.7.3130.0, time stamp: 0x5b175fed
Exception code: 0xc0000409
Fault offset: 0x0000000000302ffc
Faulting process id: 0x628
Faulting application start time: 0x01d42252ca1eb0c1
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Report Id: 0b1db391-b366-412b-9e50-6041f8832288
Faulting package full name: 
Faulting package-relative application ID: 

起初,我只是在Google上搜索了此错误代码,该错误代码很快就得出了一个STATUS_STACK_BUFFER_OVERRUN错误的结论。假设这意味着某些非托管代码正在访问内存,因此不应导致此错误。仅凭这些信息并不能真正帮助我找出问题所在,因此我们为IIS进程启用了故障转储,并在今天发生问题时设法进行了完全转储。在分析了IIS进程崩溃时创建的崩溃转储之后,我们发现该异常显然源自System.Net.Sockets.Socket.Dispose(Boolean)调用内部,该调用是对第三方Web服务进行的HttpWebRequest的一部分。此调用没有什么特别有趣的,并且使用using块正确处理了来自请求的响应。我在下面包括了dumpstack调用的顶部,因为整个堆栈太大而无法在问题中发布。我的问题是,在.NET库中发生此错误时,我应该采取哪些下一步措施来确定此错误的根本原因?像这样的异常源自Socket之类的.NET库类确实令人不安,但是我想排除我的应用程序对该库的使用导致问题的任何可能性。

0:091> .excr
rax=0000000000000001 rbx=0000000000000001 rcx=0000000000000002
rdx=000002ace1ccafc0 rsi=0000000000000004 rdi=0000000000000004
rip=00007fffa3a22ffc rsp=000000cb44a3aa50 rbp=000000cb44a3ab09
r8=000002a8081966c0  r9=0000000000008000 r10=0000000000000000
r11=000000cb44a3aa80 r12=0000000000000000 r13=000002ab00000000
r14=000002ab5346b880 r15=000002ab5346bb01
iopl=0         nv up ei pl nz na pe nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
clr!_report_gsfailure+0x1c:
00007fff`a3a22ffc cd29            int     29h
0:091> !dumpstack
OS Thread Id: 0xec (91)
Current frame: clr!_report_gsfailure+0x1c
Child-SP         RetAddr          Caller, Callee
000000cb44a3aa80 00007fffa3726cec clr!SafeHandle::Release+0xa4, calling clr!_security_check_cookie
000000cb44a3aac0 00007fffa3726e82 clr!SafeHandle::DangerousRelease+0xc2, calling clr!HelperMethodFrameRestoreState
000000cb44a3ab30 00007fffa372575a clr!FrameWithCookie<GCFrame>::FrameWithCookie<GCFrame>+0x42, calling clr!GetThread
000000cb44a3ab60 00007fffa38a3940 clr!SafeHandle::Dispose+0x30, calling clr!SafeHandle::Release
000000cb44a3abd0 00007fffa38a3a9b clr!SafeHandle::DisposeNative+0x9b, calling clr!SafeHandle::Dispose
000000cb44a3abf8 00007fffa3726e23 clr!SafeHandle::DangerousRelease+0x63, calling clr!LazyMachStateCaptureState
000000cb44a3ac60 00007fff461a27f4 (MethodDesc 00007fff463e18a8 +0x124 DomainNeutralILStubClass.IL_STUB_PInvoke(System.Net.SafeCloseSocket, Int32)), calling (MethodDesc 00007fff9bd37630 +0 System.StubHelpers.StubHelpers.SafeHandleRelease(System.Runtime.InteropServices.SafeHandle))
000000cb44a3acd0 00007fff461a2799 (MethodDesc 00007fff463e18a8 +0xc9 DomainNeutralILStubClass.IL_STUB_PInvoke(System.Net.SafeCloseSocket, Int32)), calling (MethodDesc 00007fff463e18a8 +0xf5 DomainNeutralILStubClass.IL_STUB_PInvoke(System.Net.SafeCloseSocket, Int32))
000000cb44a3ad18 00007fffa38a3a6c clr!SafeHandle::DisposeNative+0x6c, calling clr!LazyMachStateCaptureState
000000cb44a3ad30 00007fff461a2770 (MethodDesc 00007fff463e18a8 +0xa0 DomainNeutralILStubClass.IL_STUB_PInvoke(System.Net.SafeCloseSocket, Int32))
000000cb44a3ad40 00007fff45f60fd7 (MethodDesc 00007fff45489f70 +0x197 System.Net.Sockets.Socket.Dispose(Boolean)), calling (MethodDesc 00007fff9be3a800 +0 System.Runtime.InteropServices.SafeHandle.Dispose())
000000cb44a3adc0 00007fff45f6059a (MethodDesc 00007fff45489f78 +0x1a System.Net.Sockets.Socket.Dispose())
000000cb44a3add0 00007fff9c1e2fc7 (MethodDesc 00007fff9be36be8 +0x57 System.Exception.Init()), calling clr!JIT_WriteBarrier
000000cb44a3adf0 00007fff461a2607 (MethodDesc 00007fff460c6bf0 +0x57 System.Net.Sockets.NetworkStream.Dispose(Boolean)), calling (MethodDesc 00007fff454897a0 +0 System.Net.Sockets.Socket.Close(Int32))
000000cb44a3ae00 00007fff9c1f9c30 (MethodDesc 00007fff9be2c058 +0x60 System.ObjectDisposedException..ctor(System.String)), calling clr!JIT_WriteBarrier
000000cb44a3ae10 00007fff461a258c (MethodDesc 00007fff460f2b58 +0x3c System.Net.Security.SecureChannel.Close())
000000cb44a3ae30 00007fff461a212f (MethodDesc 00007fff460f04f8 +0x12f System.Net.TlsStream.Dispose(Boolean)), calling (MethodDesc 00007fff460c6bf0 +0 System.Net.Sockets.NetworkStream.Dispose(Boolean))
000000cb44a3ae40 00007fff461a252c (MethodDesc 00007fff460f0ed8 +0x4c System.Net.Security.SslState.Close()), calling (MethodDesc 00007fff460f2b58 +0 System.Net.Security.SecureChannel.Close())
000000cb44a3ae80 00007fff461a2103 (MethodDesc 00007fff460f04f8 +0x103 System.Net.TlsStream.Dispose(Boolean)), calling (MethodDesc 00007fff460f04f8 +0x10c System.Net.TlsStream.Dispose(Boolean))
000000cb44a3aed0 00007fff9c23bbea (MethodDesc 00007fff9be40fa8 +0x1a System.IO.Stream.Close())
000000cb44a3af00 00007fff48fad9df (MethodDesc 00007fff460c57c8 +0xbf System.Net.Connection.HandleError(Boolean, Boolean, System.Net.WebExceptionStatus, System.Net.ConnectionReturnResult ByRef)), calling 00007fff45f0f0b0
000000cb44a3af20 00007fff45f66a48 (MethodDesc 00007fff460f0ce8 +0x18 System.Net.Security.SslState.get_IsAuthenticated()), calling (MethodDesc 00007fff460f2b18 +0 System.Net.Security.SecureChannel.get_IsValidContext())
000000cb44a3af60 00007fff46189188 (MethodDesc 00007fff460c5818 +0xb8 System.Net.Connection.ReadComplete(Int32, System.Net.WebExceptionStatus)), calling 00007fff49f53e20
000000cb44a3afe0 00007fff46185e38 (MethodDesc 00007fff460c5808 +0x178 System.Net.Connection.SyncRead(System.Net.HttpWebRequest, Boolean, Boolean)), calling 00007fff45f0a630
000000cb44a3b040 00007fff46185355 (MethodDesc 00007fff460c1420 +0xa5 System.Net.ConnectStream.ProcessWriteCallDone(System.Net.ConnectionReturnResult)), calling 00007fff45f0a390
000000cb44a3b080 00007fff46184bbf (MethodDesc 00007fff460c1410 +0xcf System.Net.ConnectStream.CallDone(System.Net.ConnectionReturnResult)), calling 00007fff45f09d70
000000cb44a3b0d0 00007fff46181302 (MethodDesc 00007fff460c1660 +0x442 System.Net.ConnectStream.CloseInternal(Boolean, Boolean)), calling 00007fff45f09bb0
000000cb44a3b0f0 00007fffa372b3bf clr!COMInterlocked::CompareExchangeObject+0x1f, calling clr!ErectWriteBarrier
000000cb44a3b140 00007fff46180e94 (MethodDesc 00007fff460c1618 +0x24 System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(System.Net.CloseExState)), calling 00007fff45f08120
000000cb44a3b160 00007fffa38e01ec clr!GCInterface::CollectionCount+0x3c
000000cb44a3b170 00007fff461849d0 (MethodDesc 00007fff460456c8 +0x1e0 System.Net.HttpWebRequest.EndWriteHeaders_Part2()), calling 00007fff45f0ccb0
000000cb44a3b180 00007fff46184720 (MethodDesc 00007fff46045698 +0x60 System.Net.HttpWebRequest.FinishContinueWait()), calling (MethodDesc 00007fff46045698 +0x74 System.Net.HttpWebRequest.FinishContinueWait())
000000cb44a3b190 00007fff46184535 (MethodDesc 00007fff46045658 +0x15 System.Net.HttpWebRequest.ShouldWaitFor100Continue())
000000cb44a3b1c0 00007fff46184647 (MethodDesc 00007fff46045648 +0x67 System.Net.HttpWebRequest.EndWriteHeaders(Boolean)), calling 00007fff45f09750
000000cb44a3b1e0 00007fff4618441b (MethodDesc 00007fff460c56a8 +0x12b System.Net.Connection.CheckStartReceive(System.Net.HttpWebRequest)), calling (MethodDesc 00007fff4604fe90 +0 System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr))
000000cb44a3b200 00007fff46184595 (MethodDesc 00007fff46045520 +0x15 System.Net.HttpWebRequest.WriteHeadersCallback(System.Net.WebExceptionStatus, System.Net.ConnectStream, Boolean)), calling 00007fff45f093d0
000000cb44a3b230 00007fff45f66634 (MethodDesc 00007fff460c1590 +0x2e4 System.Net.ConnectStream.WriteHeaders(Boolean)), calling 00007fff45f09210
000000cb44a3b260 00007fff45f65bd1 (MethodDesc 00007fff46045788 +0x651 System.Net.HttpWebRequest.SerializeHeaders()), calling (MethodDesc 00007fff460c39f0 +0 System.Net.WebHeaderCollection+HeaderEncoding.GetBytes(System.String, Int32, Int32, Byte[], Int32))
000000cb44a3b2c0 00007fff45f651ac (MethodDesc 00007fff46045638 +0x7c System.Net.HttpWebRequest.EndSubmitRequest()), calling 00007fff45f07450
000000cb44a3b300 00007fff45f61f7b (MethodDesc 00007fff460c5648 +0x29b System.Net.Connection.CompleteConnection(Boolean, System.Net.HttpWebRequest)), calling 00007fff45f06b90
000000cb44a3b328 00007fffa38a8a81 clr!JIT_NewCrossContext_Portable+0x75, calling clr!LazyMachStateCaptureState
000000cb44a3b3a0 00007fff45f61e58 (MethodDesc 00007fff460c5648 +0x178 System.Net.Connection.CompleteConnection(Boolean, System.Net.HttpWebRequest)), calling (MethodDesc 00007fff460c5648 +0x22b System.Net.Connection.CompleteConnection(Boolean, System.Net.HttpWebRequest))
000000cb44a3b3c0 00007fff4417dc33 (MethodDesc 00007fff443e87a8 +0x13 System.Net.Logging.get_On()), calling clr!JIT_GetSharedNonGCStaticBase_InlineGetAppDomain
000000cb44a3b460 00007fff45f50dd9 (MethodDesc 00007fff460c5628 +0x179 System.Net.Connection.CompleteStartConnection(Boolean, System.Net.HttpWebRequest)), calling 00007fff45f062d0
000000cb44a3b4c0 00007fff45f50afd (MethodDesc 00007fff460c5608 +0x5d System.Net.Connection.CompleteStartRequest(Boolean, System.Net.HttpWebRequest, System.Net.TriState)), calling 00007fff45f04e80
000000cb44a3b4e0 00007fff4417dc33 (MethodDesc 00007fff443e87a8 +0x13 System.Net.Logging.get_On()), calling clr!JIT_GetSharedNonGCStaticBase_InlineGetAppDomain
000000cb44a3b510 00007fff45f4fadf (MethodDesc 00007fff460c55c8 +0x45f System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean)), calling 00007fff45f04cc0
000000cb44a3b590 00007fff45f4b65c (MethodDesc 00007fff46049360 +0x9c System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String)), calling 00007fff45f04160
000000cb44a3b5f0 00007fff45f4901d (MethodDesc 00007fff460455f8 +0x33d System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint)), calling (MethodDesc 00007fff46049360 +0 System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String))
000000cb44a3b650 00007fff45f462db (MethodDesc 00007fff46045100 +0x50b System.Net.HttpWebRequest.GetResponse()), calling 00007fff45f02100
000000cb44a3b670 00007fff45f3855a (MethodDesc 00007fff4604c3a0 +0x4a System.Net.KnownHttpVerb.Parse(System.String)), calling clr!JIT_IsInstanceOfClass
000000cb44a3b680 00007fff45f381e0 (MethodDesc 00007fff460a9e58 +0x30 System.Net.ValidationHelper.IsInvalidHttpString(System.String)), calling 00007fffa38a9d00 (stub for System.String.IndexOfAny(Char[], Int32, Int32))
000000cb44a3b6f0 00007fff4989a8a3 (MethodDesc 00007fff46ba3328 +0xd3 Royal.Common.Eligibility.Mahler.MahlerUtils.SendRequest(System.String))
000000cb44a3b700 00007fff9c236921 (MethodDesc 00007fff9be36a60 +0x71 System.String.Concat(System.String, System.String, System.String)), calling (MethodDesc 00007fff9be363a0 +0 System.String.FillStringChecked(System.String, Int32, System.String))
000000cb44a3b720 00007fff9c21668c (MethodDesc 00007fff9be360d0 +0x2c System.String.IsNullOrWhiteSpace(System.String)), calling (MethodDesc 00007fff9be38cd0 +0 System.Char.IsWhiteSpaceLatin1(Char))
000000cb44a3b760 00007fff4989a611 (MethodDesc 00007fff46ba3318 +0x341 Royal.Common.Eligibility.Mahler.MahlerUtils.SendEligibilityRequest(System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<System.DateTime>, System.String, System.String, System.String, System.Nullable`1<System.DateTime>, System.String, System.String, System.String, System.String)), calling (MethodDesc 00007fff46ba3328 +0 Royal.Common.Eligibility.Mahler.MahlerUtils.SendRequest(System.String))
000000cb44a3b800 00007fff49898a94 (MethodDesc 00007fff46ba3308 +0x164 Royal.Common.Eligibility.Mahler.MahlerUtils.SendRequest(Royal.Common.Eligibility.EligibilityRequest, System.String)), calling (MethodDesc 00007fff46ba3318 +0 Royal.Common.Eligibility.Mahler.MahlerUtils.SendEligibilityRequest(System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<System.DateTime>, System.String, System.String, System.String, System.Nullable`1<System.DateTime>, System.String, System.String, System.String, System.String))
000000cb44a3b810 00007fff9c2b7bd1 (MethodDesc 00007fff9be44758 +0xe1 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, IntPtr, System.String, System.String, Int32, Int32, Boolean, Int64))
000000cb44a3b8f0 00007fff9c23034c (MethodDesc 00007fff9bf9dd80 +0x7c System.Globalization.CompareInfo.GetHashCodeOfString(System.String, System.Globalization.CompareOptions, Boolean, Int64)), calling 00007fff9c16e4f8 (stub for System.Globalization.CompareInfo.InternalGetGlobalizedHashCode(IntPtr, IntPtr, System.String, System.String, Int32, Int32, Boolean, Int64))
000000cb44a3b920 00007fffa38ab3f3 clr!COMNlsInfo::InternalFindNLSStringEx+0x26d, calling clr!NewApis::IndexOfString
000000cb44a3b970 00007fff9c2302be (MethodDesc 00007fff9bf9bfb8 +0x2e System.CultureAwareComparer.GetHashCode(System.String)), calling (MethodDesc 00007fff9bf9dd80 +0 System.Globalization.CompareInfo.GetHashCodeOfString(System.String, System.Globalization.CompareOptions, Boolean, Int64))
000000cb44a3b9a0 00007fffa3724d15 clr!JIT_InitPInvokeFrame+0x15, calling clr!GetThread
000000cb44a3b9b0 00007fff9c20d3b5 (MethodDesc 00007fff9be3f1f0 +0x15 System.Collections.Hashtable.InitHash(System.Object, Int32, UInt32 ByRef, UInt32 ByRef))
000000cb44a3b9d0 00007fff9c2b73e0 (MethodDesc 00007fff9be44608 +0x100 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, IntPtr, System.String, Int32, System.String, Int32, Int32, System.String, Int32))
000000cb44a3ba50 00007fff9c2b73e0 (MethodDesc 00007fff9be44608 +0x100 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, IntPtr, System.String, Int32, System.String, Int32, Int32, System.String, Int32))
000000cb44a3bc80 00007fff49898859 (MethodDesc 00007fff4a9aedc8 +0x49 Royal.Common.Eligibility.EligibilityUtils+<>c__DisplayClass71_1.<SendRequestInPayerDrivenOrder>b__1()), calling (MethodDesc 00007fff46ba3308 +0 Royal.Common.Eligibility.Mahler.MahlerUtils.SendRequest(Royal.Common.Eligibility.EligibilityRequest, System.String))
000000cb44a3bcc0 00007fff498978ff (MethodDesc 00007fff46ba0440 +0x38f Royal.Common.Eligibility.EligibilityUtils.SendRequestInPayerDrivenOrder(Royal.Common.Eligibility.EligibilityRequest, Royal.Data.Model.IMF_Eligibility_Payer, Boolean, Royal.Data.Model.IMF_Eligibility_Request, Boolean, Boolean, Royal.Data.Model.RoyalContext))
000000cb44a3bcd0 00007fff4624f599 (MethodDesc 00007fff45c865e0 +0x1a9 System.Data.SqlClient.SqlTransaction.Commit()), calling (MethodDesc 00007fff45c8c160 +0 Bid.ScopeLeave(IntPtr ByRef))
000000cb44a3bce0 00007fff4623edb5 (MethodDesc 00007fff45c87090 +0x35 System.Data.Linq.SqlClient.SqlConnectionManager.set_Transaction(System.Data.Common.DbTransaction)), calling clr!JIT_WriteBarrier
000000cb44a3bdd0 00007fff49894407 (MethodDesc 00007fff46ba0430 +0xd07 Royal.Common.Eligibility.EligibilityUtils.SendRequest(System.Guid, Int32, System.Nullable`1<Int64>, System.Nullable`1<Int64>, Royal.Common.Eligibility.EligibilityRequest, Royal.Data.Model.IMF_Eligibility_Payer)), calling (MethodDesc 00007fff46ba0440 +0 Royal.Common.Eligibility.EligibilityUtils.SendRequestInPayerDrivenOrder(Royal.Common.Eligibility.EligibilityRequest, Royal.Data.Model.IMF_Eligibility_Payer, Boolean, Royal.Data.Model.IMF_Eligibility_Request, Boolean, Boolean, Royal.Data.Model.RoyalContext))
000000cb44a3bf30 00007fff49891f84 (MethodDesc 00007fff46ba04b0 +0x5d4 Royal.Common.Eligibility.EligibilityUtils.GetSingleEligibility(Int32, System.Nullable`1<Int64>, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int64>, System.Collections.Generic.List`1<Royal.Data.Model.V_Appointment>, Int32, System.String, System.String, System.String, System.String, System.String, System.Collections.Generic.HashSet`1<System.String>, System.String, Boolean, System.String, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Guid, System.Nullable`1<Int64> ByRef, System.String)), calling (MethodDesc 00007fff46ba0430 +0 Royal.Common.Eligibility.EligibilityUtils.SendRequest(System.Guid, Int32, System.Nullable`1<Int64>, System.Nullable`1<Int64>, Royal.Common.Eligibility.EligibilityRequest, Royal.Data.Model.IMF_Eligibility_Payer))
000000cb44a3bfd0 00007fff9c233c3d (MethodDesc 00007fff9be30970 +0x6d System.MulticastDelegate.RemoveImpl(System.Delegate)), calling (MethodDesc 00007fff9be308f0 +0 System.MulticastDelegate.Equals(System.Object))
000000cb44a3bff0 00007fff9c233ba5 (MethodDesc 00007fff9bd382f8 +0x25 System.Delegate.Remove(System.Delegate, System.Delegate)), calling 00007fffa37cf5b0 (stub for System.Delegate.InternalEqualTypes(System.Object, System.Object))
000000cb44a3c030 00007fff45c38cfd (MethodDesc 00007fff44915df8 +0x3d System.ComponentModel.EventHandlerList.RemoveHandler(System.Object, System.Delegate)), calling clr!JIT_WriteBarrier
000000cb44a3c040 00007fff9c1ddf3e (MethodDesc 00007fff9be3b258 +0xe System.Collections.Generic.EqualityComparer`1[[System.__Canon, mscorlib]].get_Default()), calling clr!JIT_GetGenericsGCStaticBase
000000cb44a3c060 00007fff45c38c0c (MethodDesc 00007fff45c870e8 +0x2c System.Data.Linq.SqlClient.SqlConnectionManager.RemoveInfoMessageHandler()), calling 00007fff441caa40
000000cb44a3c090 00007fff45c37885 (MethodDesc 00007fff45c870a8 +0x35 System.Data.Linq.SqlClient.SqlConnectionManager.CloseConnection()), calling (MethodDesc 00007fff45c870e8 +0 System.Data.Linq.SqlClient.SqlConnectionManager.RemoveInfoMessageHandler())
000000cb44a3c170 00007fff4989135c (MethodDesc 00007fff46ba04d0 +0x11c Royal.Common.Eligibility.EligibilityUtils.WrapEligibility(Int32, System.Nullable`1<Int64>, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int64>, System.Collections.Generic.List`1<Royal.Data.Model.V_Appointment>, Int32, System.String, System.String, System.String, System.String, System.String, System.Collections.Generic.HashSet`1<System.String>, System.String, Boolean, System.String, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Guid, System.Nullable`1<Int64> ByRef, System.String, System.Collections.Generic.List`1<System.Tuple`2<System.String,Int64>>, Royal.Common.Eligibility.EligibilityResponse ByRef, System.String)), calling (MethodDesc 00007fff46ba04b0 +0 Royal.Common.Eligibility.EligibilityUtils.GetSingleEligibility(Int32, System.Nullable`1<Int64>, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int64>, System.Collections.Generic.List`1<Royal.Data.Model.V_Appointment>, Int32, System.String, System.String, System.String, System.String, System.String, System.Collections.Generic.HashSet`1<System.String>, System.String, Boolean, System.String, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Guid, System.Nullable`1<Int64> ByRef, System.String))
000000cb44a3c270 00007fff4989031f (MethodDesc 00007fff46ba04c0 +0x64f Royal.Common.Eligibility.EligibilityUtils.GetEligibility(System.String, Int64, Int64, Int32, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Boolean, System.String, Int32, System.Collections.Generic.List`1<System.String> ByRef, Royal.Common.Eligibility.EligibilityResponse ByRef, Royal.Common.Eligibility.EligibilityResponse ByRef, System.String, System.Nullable`1<Int64> ByRef, System.Nullable`1<Int64> ByRef, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Royal.Common.Eligibility.EligibilityResponse ByRef, System.Nullable`1<Int64> ByRef, System.String)), calling (MethodDesc 00007fff46ba04d0 +0 Royal.Common.Eligibility.EligibilityUtils.WrapEligibility(Int32, System.Nullable`1<Int64>, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int64>, System.Collections.Generic.List`1<Royal.Data.Model.V_Appointment>, Int32, System.String, System.String, System.String, System.String, System.String, System.Collections.Generic.HashSet`1<System.String>, System.String, Boolean, System.String, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Guid, System.Nullable`1<Int64> ByRef, System.String, System.Collections.Generic.List`1<System.Tuple`2<System.String,Int64>>, Royal.Common.Eligibility.EligibilityResponse ByRef, System.String))
000000cb44a3c7e0 00007fff4988fca0 (MethodDesc 00007fff46ba04a0 +0x210 Royal.Common.Eligibility.EligibilityUtils.GetEligibility(System.String, Int64, Int64, Int32, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Boolean, System.String, Int32, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, System.String)), calling (MethodDesc 00007fff46ba04c0 +0 Royal.Common.Eligibility.EligibilityUtils.GetEligibility(System.String, Int64, Int64, Int32, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Boolean, System.String, Int32, System.Collections.Generic.List`1<System.String> ByRef, Royal.Common.Eligibility.EligibilityResponse ByRef, Royal.Common.Eligibility.EligibilityResponse ByRef, System.String, System.Nullable`1<Int64> ByRef, System.Nullable`1<Int64> ByRef, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Royal.Common.Eligibility.EligibilityResponse ByRef, System.Nullable`1<Int64> ByRef, System.String))
000000cb44a3c990 00007fff4988f973 (MethodDesc 00007fff477a9ec8 +0x543 Products.RoyalAppointments.EligibilityCheck(System.String, Int64, Int64, Int32, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Boolean, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, System.String)), calling (MethodDesc 00007fff46ba04a0 +0 Royal.Common.Eligibility.EligibilityUtils.GetEligibility(System.String, Int64, Int64, Int32, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, Boolean, System.String, Int32, System.Collections.Generic.List`1<System.String> ByRef, System.String, System.Nullable`1<Int32>, System.String, System.String, System.String, System.String, System.String, Boolean, System.String))
000000cb44a3c9b0 00007fffa37c1a4d clr!CustomAttributeParser::GetNonNullString+0xe, calling clr!CustomAttributeParser::GetString
000000cb44a3cb50 00007fffa3726bc3 clr!CallDescrWorkerInternal+0x83
000000cb44a3cc80 00007fffa3726a80 clr!CallDescrWorkerWithHandler+0x4e, calling clr!CallDescrWorkerInternal
000000cb44a3cca0 00007fff9c1ddf1b (MethodDesc 00007fff9be3a8d8 +0x5b System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]]..ctor(Int32, System.Collections.Generic.IEqualityComparer`1<System.__Canon>)), calling clr!JIT_WriteBarrier
000000cb44a3ccb0 00007fffa3814006 clr!MetaSig::GetElemSize+0x3c, calling clr!TypeHandle::GetSize
000000cb44a3ccc0 00007fffa377bfe6 clr!CallDescrWorkerReflectionWrapper+0x1a, calling clr!CallDescrWorkerWithHandler
000000cb44a3cd10 00007fffa377c49f clr!RuntimeMethodHandle::InvokeMethod+0x45f, calling clr!CallDescrWorkerReflectionWrapper
000000cb44a3cd30 00007fffa37278c9 clr!ArgIteratorTemplate<ArgIteratorBase>::GetNextOffset+0x51, calling clr!ArgIteratorBase::IsVarArg
000000cb44a3cd60 00007fffa372737d clr!MethodDescCallSite::CallTargetWorker+0x108, calling clr!_security_check_cookie

进行WebRequest调用的代码如下所示。但应注意的是,并非每次都发生此异常,该过程可能运行一天,并在我们看到该异常之前执行该代码数千次。

        var wreq = (HttpWebRequest) WebRequest.Create(url);
        wreq.Method = WebRequestMethods.Http.Get;
        wreq.Timeout = 30000;
        byte[] content;
        using (var wres = (HttpWebResponse) wreq.GetResponse())
        {
            using (var rs = wres.GetResponseStream())
            {
                using (var ms = new MemoryStream())
                {
                    int count;
                    var buf = new byte[4096];
                    while ((count = rs.Read(buf, 0, buf.Length)) > 0)
                        ms.Write(buf, 0, count);
                    content = ms.ToArray();
                }
            }
        }

0 个答案:

没有答案