My assemblies that wrap a third-party DLL work fine in my windows test harness app, and they also work fine in a web service when spawned in debug mode (VS 2008 Visual Studio Development Server)! However, the app always crashes when running in the local IIS 7 web server. Here is the crash detail from the event log when running on the local IIS server:
Faulting application w3wp.exe, version 7.0.6001.18000, time stamp 0x47919413, faulting module ntdll.dll, version 6.0.6001.18000, time stamp 0x4791a783, exception code 0xc0000374, fault offset 0x000aada3, process id 0x990, application start time 0x01c9b4133281d5d0.
Discussion: I wrote a wrapper around a .NET dll from a third-party (LinkPointTransaction.dll from FirstData), and I wrote some other assemblies that reference that wrapper. As the code is running, a call to the third-party LinkPointTransaction.LinkPointTxn.Send() sends the transaction successfully to FirstData over the internet, but my application crashes w3wp.exe somewhere during that call, before it hits the next line. It does not throw a managed exception that I can see; it just crashes. Works fine everywhere on my machine except in IIS7.
I am running 64bit Vista Home Premium (IIS7), but I enabled 32bit apps in IIS, created a separate AppPool just for this web service, and have forced all of my assemblies to x86. I have tried running the App Pool under my user account with Admin privileges instead of as the Network Service. UAC is turned off. I have tried Integrated and Classic modes. I have explicitly opened the TCP/IP port in my local firewall that the LinkPointTransaction.dll uses to communicate with FirstData. I even have shut my firewall off (behind a router).
With any of these workarounds that I listed, it always works in a Windows app and also in a web service inside the VS Development Server, but never works in the local IIS server.
The AppPool for the IIS website is in Classic mode. (In response to Gidon)
I don't think this is a programming question anymore, so I am 'answering' it.
Using WinDbg, I have tracked it down to the dll provided by the vendor. When the app crashes, it looks like a problem with the way the dll is de-allocating memory. The call stack shows a memory free operation in the dll, then a "heap free" operation in the kernel, then a "free heap" operation in ntdll, and a subsequent "report heap failure" (and then RtlReportCriticalFailure) that tears down the whole thing.
I still don't understand why it works in a Windows Forms app and in IIS 6, but not work in IIS 7. However, this has become more of a platform question than a 'programming' question. Besides, it is probably the vendor's responsibility to fix it rather than mine to work around it.
UPDATE: Within two days of filing the tech support ticket with the vendor, they provided an updated set of the integration DLLs that use a COM object that you register with regsvr32, and it works in IIS7 64-bit if you register it in the WOW64 directory. YEA FOR FIRST DATA TECHNICAL SUPPORT!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With