繁体   English   中英

ASP.NET 2.0应用程序以IIS 5隔离模式在Win 2003上运行,但未以(默认)IIS 6模式运行

[英]ASP.NET 2.0 app runs on Win 2003 in IIS 5 isolation mode but not in (default) IIS 6 mode

该应用程序使用DL​​LImport来调用旧版非托管dll。 为了这个问题,我们将此dll称为Unmanaged.dll。 Unmanaged.dll依赖于其他5个旧dll。 所有旧版dll都放在我的ASP.NET应用程序的WebApp / bin /目录中。

当IIS在5.0隔离模式下运行时,该应用程序可以正常工作-对旧版dll的调用将得到处理,而不会出现错误。

当IIS在默认的6.0模式下运行时,该应用程序能够启动Unmanaged.dll(InitMe()),但在以后对其进行调用(ProcessString())时死亡。

我在这里拔头发。 我已经将非托管dll移到了各个位置,尝试了各种安全设置,并竭尽全力地寻找解决方案。 救命!

样例代码:

[DllImport("Unmanaged.dll", EntryPoint="initME", CharSet=System.Runtime.InteropServices.CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
    internal static extern int InitME();
//Calls to InitMe work fine - Unmanaged.dll initiates and writes some entries in a dedicated log file
[DllImport("Unmanaged.dll", EntryPoint="processString", CharSet=System.Runtime.InteropServices.CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
    internal static extern int ProcessString(string inStream, int inLen, StringBuilder outStream, ref int outLen, int maxLen);
//Calls to ProcessString cause the app to crash, without leaving much of a trace that I can find so far

更新:

返回堆栈,取自小型转储。 似乎是堆栈溢出,但是我想知道是否有人可以帮助我。 加载了sos.dll的WinDbg中的“ kb”结果:

1beb51fc 7c947cfb 7c82202c 00000002 1beb524c ntdll!KiFastSystemCallRet  
1beb5200 7c82202c 00000002 1beb524c 00000001 ntdll!NtWaitForMultipleObjects+0xc  
WARNING: Stack unwind information not available. Following frames may be wrong.  
1beb52a8 7c822fbe 00000002 1beb52ec 00000000 kernel32!WaitForMultipleObjectsEx+0xd2  
1beb52c4 7a2e1468 00000002 1beb52ec 00000000 kernel32!WaitForMultipleObjects+0x18  
1beb5308 7a2d00c4 7a0c3077 1bc4ffd8 1bc4ffd8 mscorwks!CreateHistoryReader+0x19e9d  
1beb531c 7a0c312f 7a0c3077 1bc4ffd8 888d9fd9 mscorwks!CreateHistoryReader+0x8af9  
1beb5350 7a106b2d 1b2733a0 00000001 1b2733a0 mscorwks!GetCompileInfo+0x345ed  
1beb5378 7a105b91 1b272ff8 1b2733a0 00000001 mscorwks!GetAddrOfContractShutoffFlag+0x93a8  
1beb53e0 7a105d46 1beb5388 1b272ff8 1beb5520 mscorwks!GetAddrOfContractShutoffFlag+0x840c  
1beb5404 79fe29c5 00000001 00000000 00000000 mscorwks!GetAddrOfContractShutoffFlag+0x85c1  
1beb5420 7c948752 1beb5504 1beef9b8 1beb5520 mscorwks!NGenCreateNGenWorker+0x4d52  
1beb5444 7c948723 1beb5504 1beef9b8 1beb5520 ntdll!ExecuteHandler2+0x26  
1beb54ec 7c94855e 1beb1000 1beb5520 1beb5504 ntdll!ExecuteHandler+0x24  
1beb54ec 1c9f2264 1beb1000 1beb5520 1beb5504 ntdll!KiUserExceptionDispatcher+0xe  
1beb57f4 1c92992d 1beb6e28 1db84d70 1db90e28 Unmanaged1!UMgetMaxSmth+0x1200ad  
1beb5860 1c929cfe 00000000 1db84d70 1beb6e28 Unmanaged1!UMgetMaxSmth+0x57776  
1beb58c0 1c930b04 00000000 1db84d70 1beb6e28 Unmanaged1!UMgetMaxSmth+0x57b47  
1beb5924 1c99d088 00000000 1db84d70 1beb6e28 Unmanaged1!UMgetMaxSmth+0x5e94d  
1beb5990 1c99c955 00000000 1beb6e28 1beb6590 Unmanaged1!UMgetMaxSmth+0xcaed1  
1beb5a44 1c99e9ae 00000000 40977000 1db90e28 Unmanaged1!UMgetMaxSmth+0xca79e  

解决方案:创建一个新线程以在其中运行导入的dll,并为其堆栈分配更多的内存。

给出什么错误? 如果应用程序确实崩溃了,则可能必须进入Windows事件日志以获取错误的堆栈跟踪。

我已经运行了procmon,debugdiag,并尝试使用Microsoft调试工具。 每次应用程序崩溃时,Watson博士都会创建一对文件-.dmp和.tmp(我曾尝试对其进行调试,但未成功)。

这是事件日志中的错误:

事件类型:错误
事件源:.NET Runtime 2.0错误报告
事件类别:无
场次编码:1000
日期:2008年9月30日
时间:16:13:38
用户:不适用
计算机:APPLICATIONTEST010
描述:
错误的应用程序w3wp.exe,版本6.0.3790.3959,戳45d6968e,错误的模块Unmanaged1.dll,版本0.0.0.0,戳48b6bfb8,调试吗? 0,故障地址0x00122264。

我认为这里要寻找的潜在问题是您的DLL可能会在调用InitME和ProcessString之间由运行时卸载-因此,如果ProcessString依赖于首先被调用的InitME,它可能会“繁荣”。

解决方案是使用良好的旧LoadLibrary和FreeLibrary强制运行时,以在调用这两个函数之间保持库加载。 不需要GetProcAddress(据我所知)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM