I have a managed C++ class that exposes a COM object to ASP.NET. This
COM object creates several other COM objects internally. A VS.NET
2002 build of the dll works fine on .NET 1.0 and 1.1. A VS.NET 2003
build, however, fails when the COM object calls CoCreateInstance.
This happens only if the .NET type is used by two web applications on
the same server. The first web app to create the .NET type always
succeeds and the second web app always fails. CoCreateInstance throws
DllNotFoundExceptioin(0x80131524). All COM objects are threading
model 'both' so 'ASPCOMPAT' is not set to 'true' in the ASP.NET pages.
As a test, I've written a test that does nothing but expose 1 property
and the COM object calls CoCreateInstance in the property getter. The
failure occurs in this simple test. I've tried puting the dll in the
GAC and C:\winnt\system32, but the error still occurs.
I'd prefer to use a VS.NET 2003 build to take advantage of the fix to
the AppDomainUnloaded exception in the VS.NET 2003 VC++ compiler
(http://support.microsoft.com/?kbid=309694).
Any advice would be much appreciated.