【发布时间】:2017-12-09 15:57:21
【问题描述】:
我有一个 MVC4 应用程序,它加载一些 DLL。基本上,MVC 应用程序的架构是这样的:应用程序从用户那里接收一些作业,它从 dll 中调用处理函数,最后通过电子邮件将结果发送给用户。
所有 dll 都是在 64 位上编译的,我在 Windows Server 2012R2 和 VS2013 上使用 64 位上的 IIS8。 当我运行/部署应用程序时,它的行为是:
-
Scenario1:在 VS2013 中从 Visual Studio 2013 运行,包括在调试/发布模式下的 Web 服务器 (IIS Express) => 工作正常 -
Scenario2:在发布模式下从部署在本地完整 IIS8 中的 Visual Studio 2013 运行 => 工作正常 -
Scenario3:在本地完整 IIS8 中以发布模式部署并直接从浏览器运行,无需打开 VS2013 => IIS 崩溃并出现An unhandled win32 exception occurred in w3wp.exe.The Just-ln-Time debugger was launched without necessary security permissions. To debug this process, the Just-ln-Time debugger must be run as an Administrator.当我打开调试器时,错误是:A heap has been corrupted。
在事件查看器中,日志是:
Faulting application name: w3wp.exe, version: 8.5.9600.16384, time stamp: 0x5215df96
Faulting module name: ntdll.dll, version: 6.3.9600.18821, time stamp: 0x59ba86db
Exception code: 0xc0000374
我知道异常代码 0xc0000374 来自Heap corruption。
我使用 DebugDiag 和 Application Verifier 调试了 IIS,并激活了 Full PageHeap 标志。 崩溃线程堆栈的相关部分是:
.NET Call Stack
mscorlib_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr)+68
[[InlinedCallFrame] (Microsoft.Win32.Win32Native.LocalFree)] Microsoft.Win32.Win32Native.LocalFree(IntPtr)
mscorlib_ni!System.Runtime.InteropServices.Marshal.FreeHGlobal(IntPtr)+2d
Species_DLL.Class1.Species_MetaModel()+b955
rIAMTestMVC4.Impressions.SpeciesUtil.use_Species_Integrated(Int32)+1efd
Full Call Stack
vrfcore!VerifierStopMessageEx+6f4
vrfcore!VfCoreRedirectedStopMessage+90
verifier!VerifierStopMessage+a0
verifier!AVrfpDphReportCorruptedBlock+2a7
verifier!AVrfpDphCheckNormalHeapBlock+c8
verifier!AVrfpDphNormalHeapFree+27
verifier!AVrfDebugPageHeapFree+af
ntdll!RtlDebugFreeHeap+47
ntdll!RtlpFreeHeap+74c85
ntdll!RtlFreeHeap+368
vrfcore!VfCoreRtlFreeHeap+1e
KERNELBASE!LocalFree+2e
mscorlib_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr)+68
[[InlinedCallFrame] (Microsoft.Win32.Win32Native.LocalFree)] Microsoft.Win32.Win32Native.LocalFree(IntPtr)
mscorlib_ni!System.Runtime.InteropServices.Marshal.FreeHGlobal(IntPtr)+2d
Species_DLL.Class1.Species_MetaModel()+b955
rIAMTestMVC4.Impressions.SpeciesUtil.use_Species_Integrated(Int32)+1efd
Scenario2 和 Scenario3 有什么不同吗? VS 是否有任何堆保护?
我还在使用 IIS7 的 Windows7 上运行相同的场景,并且在所有三个上都可以正常工作。
我无权访问 DLL 代码,但正如我所提到的,相同的代码可以在 IIS7/Windows7 和 Visual Studio 的 IIS8 上完美运行。
LE:调用堆栈中显示了两个函数:
-
rIAMTestMVC4.Impressions.SpeciesUtil.use_Species_Integrated=> 这个函数来自MVC控制器,它调用一个dll -
Species_DLL.Class1.Species_MetaModel=> 此函数来自 dll,由前一个函数调用。
如何解决方案3的问题?这些场景之间有什么区别?
谢谢,
【问题讨论】:
标签: asp.net-mvc-4 iis visual-studio-2013 iis-7 iis-8