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 ind开发者_如何学Goicates 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!
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?
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:
Link
I hope this can help other people in the future.
精彩评论