tags:

views:

102

answers:

2

Hi all,

I am currently moving an ASP.NET web-project from an IIS 6 to a IIS 7 hosting environment. Everything seems to be running OK, except my calls to a COM object.

I can perfectly instantiate an object of the COM type, but when I call one of its methods, the IIS crashes. The event log reports an error code "0xc0000374", which indicates a heap corruption.

When I run the application inside the visual studio development server, everything goes well and the COM object code gets executed without any errors. This is also the case when the application is hosted on an IIS 6 machine.

I have looked through all settings of the IIS 7 and have not found anything configurable for COM objects, like security or ...

I have been struggling with this for a while and I'm out of ideas. Does anyone have any experience deploying COM objects on IIS 7?

Your help would be very appreciated!

A: 

COM objects need to be registered on the server as far as I remember, by using regsvr32 or even better adding these in Control Panel > Administrative Tools > Component Services?

Mark Redman
Yes of course, the COM objects are registered with regsvr32. Otherwise running inside the visual studio development server wouldn't have worked either.
w00ter
A: 

Phew... I found the solution!!

The Delphi COM object I am using, was returning a string that holds the path to the generated image file. Because the Delphi code gave that string as a result, or return value for C# developers. The memory allocated for that variable was inaccessible for my C# code, which resulted in the heap corruption or error code "0xc0000374".

I solved it by rewriting the Delphi code to accept a "ref" variable for the file path, so it would write to the same pointer as the string variable I create in C#.

Lucky for my I have access to the COM object source code...

I got the inspiration from the following article:

http://blogs.msdn.com/b/asiatech/archive/2009/12/24/net-application-may-crash-on-windows-2008-when-calling-function-from-native-c-dll.aspx

I hope this can help other people in the future.

w00ter