I have a MVC4 application, which loads some DLLs. Basically, the architecture of the MVC application is this: the app receives some jobs from the user, it calls the processing functions from dlls and in the end, emails the results to the user.
All dlls are compiled on 64bits, I use IIS8 on 64 bits, on Windows Server 2012R2 and VS2013. When I run/deploy the application, its behaviour is:
Scenario1
: Run from Visual Studio 2013 in VS2013 included web server (IIS Express) in Debug/Release Mode => works fineScenario2
: Run from Visual Studio 2013 deployed in local full IIS8 in Release Mode => works fineScenario3
: Deployed in Release Mode in local full IIS8 and run directly from browser, without having open VS2013 => IIS crashes withAn 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.
When I open the debugger, the error is:A heap has been corrupted
.
In event viewer, the logs are:
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
I know that exception code 0xc0000374 comes from Heap corruption
.
I debugged IIS using DebugDiag and Application Verifier, with Full PageHeap flags activated. The relevant part of the stack for the crashing thread is:
.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
Are there any differences between Scenario2 and Scenario3? Is there any heap protection that is done by VS?
I also run the same scenarios on Windows7 with IIS7 and works fine on all three.
I don't have access to DLL code, but as I mentioned, the same code runs perfectly on IIS7/Windows7 and on IIS8 from Visual Studio.
LE: There are two functions shown in call stack:
rIAMTestMVC4.Impressions.SpeciesUtil.use_Species_Integrated
=> This function is from MVC controller, which calls one dllSpecies_DLL.Class1.Species_MetaModel
=> This function is from dll, called by previous function.
How can I resolve the problem of scenario3? What are the differences between these scenarios?
Thank you,