我不确定这个问题是否应该发布在这里或者更好地发布在 StackOverflow.com 上,但让我们先在这里尝试。
配置是运行 ASP.NET 2.0 网站的 Windows 2008 R2 64 位服务器。该项目已以调试版本的形式部署,并针对“任何 CPU”构建。它正在使用外部方法(见下文),并且还会启动第三方进程以执行某些任务。
服务器频繁崩溃,没有显示任何托管堆栈跟踪。IIS7 工作进程就这么死了。我无法将其归结为导致它的特定操作。设置性能计数器没有显示任何异常。服务器是 64 位 Win 2008 R2。我最好的猜测是崩溃是由代码中使用的外部方法之一引起的。有人能从调试器输出和此处列出的方法中得出什么结论吗?有没有办法查看以下方法之一是否导致了崩溃?我没有检查崩溃转储的经验,所以我希望在这里得到一些帮助或启发。
调试器在“字段”部分显示的内容在我看来像是一堆被推送到堆栈上的参数。我想知道这些是否与以下方法之一相关?
关于如何进行以及尝试什么还有其他想法吗?
我怀疑崩溃是由这些调用之一引起的:
[DllImport( "urlmon.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false )]
static extern int FindMimeFromData( IntPtr pBC,
[MarshalAs( UnmanagedType.LPWStr )] string pwzUrl,
[MarshalAs( UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1, SizeParamIndex = 3 )]
byte[] pBuffer,
int cbSize,
[MarshalAs( UnmanagedType.LPWStr )] string pwzMimeProposed,
int dwMimeFlags,
out IntPtr ppwzMimeOut,
int dwReserved );
[DllImport( "advapi32.dll", SetLastError = true )]
private static extern int LogonUser( string lpszUserName,
string lpszDomain,
string lpszPassword,
int dwLogonType,
int dwLogonProvider,
ref IntPtr phToken );
[DllImport( "advapi32.dll", CharSet = CharSet.Auto, SetLastError = true )]
private static extern int DuplicateToken( IntPtr hToken,
int impersonationLevel,
ref IntPtr hNewToken );
[DllImport( "advapi32.dll", CharSet = CharSet.Auto, SetLastError = true )]
private static extern bool RevertToSelf();
[DllImport( "kernel32.dll", CharSet = CharSet.Auto )]
private static extern bool CloseHandle( IntPtr handle );
[DllImport("kernel32.dll")]
private static extern bool SetProcessWorkingSetSize (IntPtr oProc, int iMin, int iMax);
[DllImport( "query.dll", SetLastError = true, CharSet = CharSet.Unicode )]
static extern int LoadIFilter( string pwcsPath, [MarshalAs( UnmanagedType.IUnknown )] object pUnkOuter, ref IFilter ppIUnk );
[DllImport( "query.dll", SetLastError = true, CharSet = CharSet.Unicode )]
static extern int BindIFilterFromStream( Stream pStm, [MarshalAs( UnmanagedType.IUnknown )] object pUnkOuter, ref IFilter ppIUnk );
[ComImport, Guid( "89BCB740-6119-101A-BCB7-00DD010655AF" )]
[InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
private interface IFilter
{
[DllImport(@"CMCOnBehalf_dll.dll", SetLastError = true,
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int DoEnrollForMe(
string sUserId,
string sPFXPwd,
string strSysPwd,
string sCAConfigName,
string wszCATemplateName,
string sCertSubjectName,
string sCertFileName,
string strAltEmail,
string strAltPrincipal
);
// Late-binding...
[DllImport(@"CMCOnBehalf_dll.dll", SetLastError = true,
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int DoRenewForMe(
string sUserId,
string sPFXPwd,
string strSysPwd,
string sCAConfigName,
string wszCATemplateName,
string sInputSerial,
string strInputSubject,
string sCertFileName,
string strAltEmail,
string strAltPrincipal,
ref string wszOutputSerial
);
// Late-binding...
[DllImport(@"CMCOnBehalf_dll.dll", SetLastError = true,
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int DoRevokeForMe(
string sSerialID,
string sCAConfigName
);
// Late-binding...
[DllImport(@"CMCOnBehalf_dll.dll", SetLastError=true,
CharSet = CharSet.Auto, CallingConvention=CallingConvention.StdCall
)]
public static extern int SetLogLevelForBlogger(
string logFile,
int cbLogLevel
);
这是我从 WinDbg 和崩溃转储获得的信息:
MANAGED_OBJECT: !dumpobj 1a1583c80
Name: System.String
MethodTable: 000007fef9127ca0
EEClass: 000007fef8d2e550
Size: 2296(0x8f8) bytes
GC Generation: 0
(C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
String: at System.Web.Hosting.UnsafeIISMethods.MgdIsLastNotification(IntPtr pRequestContext, RequestNotificationStatus dwStatus)
at System.Web.HttpRuntime.FinishRequestNotification(IIS7WorkerRequest wr, HttpContext context, RequestNotificationStatus& status)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
Fields:
MT Field Offset Type VT Attr Value Name
000007fef912ef10 4000096 8 System.Int32 1 instance 1136 m_arrayLength
000007fef912ef10 4000097 c System.Int32 1 instance 1135 m_stringLength
000007fef91296e8 4000098 10 System.Char 1 instance 20 m_firstChar
000007fef9127ca0 4000099 20 System.String 0 shared static Empty
>> Domain:Value 00000000002d1980:00000001bf690370 0000000001ab43f0:00000001bf690370 <<
000007fef9129598 400009a 28 System.Char[] 0 shared static WhitespaceChars
>> Domain:Value 00000000002d1980:00000001bf690b60 0000000001ab43f0:00000001df690390 <<
EXCEPTION_MESSAGE: Attempted to read or write protected memory. This is often an indication that other memory is corru
MANAGED_OBJECT_NAME: SYSTEM.ACCESSVIOLATIONEXCEPTION
MANAGED_STACK_COMMAND: ** Check field _remoteStackTraceString **;!do 1002be1e8;!do 1a1583c80
LAST_CONTROL_TRANSFER: from 000007fef9d99413 to 000007fefd4fcacd
PRIMARY_PROBLEM_CLASS: WRONG_SYMBOLS
BUGCHECK_STR: APPLICATION_FAULT_WRONG_SYMBOLS_CLR_EXCEPTION
STACK_TEXT:
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.UnsafeIISMethods.MgdIsLastNotification+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.HttpRuntime.FinishRequestNotification+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.HttpRuntime.ProcessRequestNotificationPrivate+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper+0x0
00000000`00000000 00000000`00000000 unknown!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification+0x0
0:048> !aspxpages
Going to dump the HttpContexts found in the heap.
Loading the heap objects into our cache.
HttpContext Timeout Completed Running ThreadId ReturnCode Verb RequestPath+QueryString
0x0000000100233f88 11647 Sec no 14 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x0000000100292250 36000 Sec no 7 Sec XXX 200 GET /systools/lbchecker.aspx
0x0000000160286d10 36000 Sec no 14 Sec XXX 200 GET /fs/getcustomerfile.aspx sconfigvalue=1%3a%3a2%3a%3a-1%3a%3a-1%3a%3av8.20-login-image.png&iheight=320&iwidth=-1&h=0e9784b59a8712a7518401629a908709b32f724f8b7c831ba045743a81a5fef0
0x0000000160293a30 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x00000001602ae740 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x00000001602c9450 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x00000001602e4160 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x00000001602fee70 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x0000000160319b80 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x0000000160334890 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x000000016034f5a0 11647 Sec no 13 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x000000016036a378 11647 Sec no 13 Sec 50 200 POST /testwebservice/v3/services.svc/IHome
0x000000018f6e4818 36000 Sec no 68676 Sec XXX 200 GET /systools/lbchecker.aspx
0x00000001903a2fc8 36000 Sec no 14 Sec XXX 200 GET /default.aspx cookieCheck=true
0x00000001904496c8 36000 Sec no 14 Sec XXX 200 POST /testadminservice/testadminservice.asmx
0x00000001b040efd8 36000 Sec no 26 Sec XXX 200 GET /newdr/drcontent.aspx intID=5538807
0x00000001b0435b60 36000 Sec no 5 Sec XXX 200 GET /systools/lbchecker.aspx
0x00000001c0383688 36000 Sec no 25 Sec XXX 200 GET /newdr/drcontent.aspx intID=5538807
0x00000001c0732f50 36000 Sec no 9 Sec XXX 200 POST /testadminservice/testadminservice.asmx/SystemTest
0x00000001d0661a60 11647 Sec no 14 Sec XXX 200 POST /testwebservice/v3/services.svc/IHome
0x00000001e051dd68 36000 Sec no 8 Sec XXX 200 GET /systools/lbchecker.aspx
0x00000001f0e03ff0 36000 Sec no 5 Sec XXX 200 GET /systools/lbchecker.aspx
Total 22 HttpContext objects