简体   繁体   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

The app uses DLLImport to call a legacy unmanaged dll. 该应用程序使用DL​​LImport来调用旧版非托管dll。 Let's call this dll Unmanaged.dll for the sake of this question. 为了这个问题,我们将此dll称为Unmanaged.dll。 Unmanaged.dll has dependencies on 5 other legacy dll's. Unmanaged.dll依赖于其他5个旧dll。 All of the legacy dll's are placed in the WebApp/bin/ directory of my ASP.NET application. 所有旧版dll都放在我的ASP.NET应用程序的WebApp / bin /目录中。

When IIS is running in 5.0 isolation mode, the app works fine - calls to the legacy dll are processed without error. 当IIS在5.0隔离模式下运行时,该应用程序可以正常工作-对旧版dll的调用将得到处理,而不会出现错误。

When IIS is running in the default 6.0 mode, the app is able to initiate the Unmanaged.dll (InitMe()), but dies during a later call to it (ProcessString()). 当IIS在默认的6.0模式下运行时,该应用程序能够启动Unmanaged.dll(InitMe()),但在以后对其进行调用(ProcessString())时死亡。

I'm pulling my hair out here. 我在这里拔头发。 I've moved the unmanaged dll's to various locations, tried all kinds of security settings and searched long and hard for a solution. 我已经将非托管dll移到了各个位置,尝试了各种安全设置,并竭尽全力地寻找解决方案。 Help! 救命!

Sample code: 样例代码:

[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

Update: 更新:

Back with a stack, taken from a mini dump. 返回堆栈,取自小型转储。 Seems to be a stack overflow, but I'd like to know more if someone can help me out. 似乎是堆栈溢出,但是我想知道是否有人可以帮助我。 Results of "kb" in WinDbg with sos.dll loaded: 加载了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,并为其堆栈分配更多的内存。

What is the error given? 给出什么错误? if the application truly crashed you might have to go into the Windows Event Log to get the stack trace of the error. 如果应用程序确实崩溃了,则可能必须进入Windows事件日志以获取错误的堆栈跟踪。

I've run procmon, debugdiag, tried to work with microsoft debugging tools. 我已经运行了procmon,debugdiag,并尝试使用Microsoft调试工具。 Each time the app crashes, Dr. Watson creates a pair of files - .dmp and .tmp (which I have tried to debug without success). 每次应用程序崩溃时,Watson博士都会创建一对文件-.dmp和.tmp(我曾尝试对其进行调试,但未成功)。

Here's the error from the Event Log: 这是事件日志中的错误:

Event Type: Error 事件类型:错误
Event Source: .NET Runtime 2.0 Error Reporting 事件源:.NET Runtime 2.0错误报告
Event Category: None 事件类别:无
Event Code: 1000 场次编码:1000
Date: 30.09.2008 日期:2008年9月30日
Time: 16:13:38 时间:16:13:38
User: Not Applicable 用户:不适用
Computer: APPLICATIONTEST010 计算机:APPLICATIONTEST010
Description: 描述:
Faulting application w3wp.exe, version 6.0.3790.3959, stamp 45d6968e, faulting module Unmanaged1.dll, version 0.0.0.0, stamp 48b6bfb8, debug? 错误的应用程序w3wp.exe,版本6.0.3790.3959,戳45d6968e,错误的模块Unmanaged1.dll,版本0.0.0.0,戳48b6bfb8,调试吗? 0, fault address 0x00122264. 0,故障地址0x00122264。

I think a potential problem to look for here is that your DLL could be unloaded by runtime between calls to InitME and ProcessString - so if ProcessString depends on InitME being called first, it might go "boom". 我认为这里要寻找的潜在问题是您的DLL可能会在调用InitME和ProcessString之间由运行时卸载-因此,如果ProcessString依赖于首先被调用的InitME,它可能会“繁荣”。

The solution to that would be using good old LoadLibrary and FreeLibrary to force runtime to keep the library loaded between calls to those two functions. 解决方案是使用良好的旧LoadLibrary和FreeLibrary强制运行时,以在调用这两个函数之间保持库加载。 GetProcAddress is not needed (as far as I can tell). 不需要GetProcAddress(据我所知)。

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

相关问题 IIS崩溃经常发生。.IIS 6 Win 2003上的ASP.net应用程序 - IIS crash occurs often.. ASP.net app on IIS 6 Win 2003 IIS ASP.NET何时使用集成模式或经典模式? - IIS ASP.NET when to use Integrated Mode or Classic Mode? IIS 8.5中经典模式下ASP.NET 2.0网站的自定义处理程序抛出500错误 - Custom handlers for ASP.NET 2.0 Website in Classic mode in IIS 8.5 throwing 500 error URL路由在aps.net 2.0经典模式下的IIS 7.0中不起作用 - URL Routing is not working in IIS 7.0 witrh apllication pool asp.net 2.0 Classical Mode 在IIS 8.5和Windows Server 2012 R2上运行的ASP.NET应用程序的默认GC模式 - Default GC mode for ASP.NET applications running on IIS 8.5 and Windows Server 2012 R2 IIS集成管道模式下的ASP.NET URL重写 - asp.net url rewriting with IIS integrated pipeline mode 将asp.net应用程序转换为IIS7集成模式 - Convert an asp.net application to IIS7 integrated mode 如何在IIS6和asp.net中配置上载文件夹? 赢得服务器2003 SP2 - How do I configure a upload folder in IIS6 and asp.net? win server 2003 sp2 asp.net mvc on asp.net 2.0 + ajax extensions 1.0 + iis 6 on win 2k3 server - asp.net mvc on asp.net 2.0 + ajax extensions 1.0 + iis 6 on win 2k3 server IIS 10上的ASP.NET 2.0 app删除部分DOM - Part of DOM is deleted in ASP.NET 2.0 app on IIS 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM