Using a C # Class Library as a COM + Server Application

I created a .NET class library in C # and exposed it to COM. It works great as a COM server. However, I want to use it as an out-proc COM server to have it in a separate process.

For this, I am trying to create a COM + application. I created an empty COM + application and added the classes implemented in the class library to it. When I call CoCreateInstance () to create an instance of the class implemented in the library, the COM + surrogate process encounters an access violation and ends (discards the sheets).

Are there any special steps needed to create a class library that can be used as an Out-proc COM server in COM +?

The COM + surrogate process crashes with the following crash dump:

Exception: C0000005
Address: 0x000C1618

Call stack:
! + 0xC1618
mscorwks! Ordinal79 + 0xE41C
mcorwks! Ordinal79 + 0xE4AD
mcorwks! CoInitializeEE + 0x563F
mcorwks! CoInitializeEE + 0x5672
mcorwks! CoInitializeEE + 0x57F1
mcorwks! CoInitializeCor + 0x210E
mcorwks! CoInitializeCor + 0x48D
mcorwks! Ordinal79 + 0x16D2
mscorwks! ReleaseFusionInterfaces + 0x20B28
COMSVCS! + 0xC29A2
COMSVCS! + 0xC2BDA
COMSVCS! CoCreateStdTrustable + 0xCB10
ole32! CoMarshalInterface + 0x2642
ole32! CoInstall + 0x673
ole32! CoQueryAuthenticationServices + 0x1F44
ole32! CoQueryAuthenticationServices + 0x2862
ole32! CoWaitForMultipleHandles + 0xC267
ole32! CoQueryClientBlanket + 0x16CE
ole32! CoCreateObjectInContext + 0xC8E
ole32! CoInstall + 0x87A
ole32! CoWaitForMultipleHandles + 0x10479
ole32! CoMarshalInterface + 0x2808
ole32! CoGetTreatAsClass + 0xBE7
ole32! CoGetTreatAsClass + 0xB9E
ole32! CoMarshalInterface + 0x28F2
ole32! CoMarshalInterface + 0x2642
COMSVCS! CoCreateStdTrustable + 0x106A4
ole32! CoMarshalInterface + 0x2642
ole32! CoPopServiceDomain + 0x14FE
RPCRT4! CheckVerificationTrailer + 0x70
RPCRT4! NdrStubCall2 + 0x215
RPCRT4! CStdStubBuffer_Invoke + 0x82
ole32! StgGetIFillLockBytesOnFile + 0xFC92
ole32! StgGetIFillLockBytesOnFile + 0xFC3C
ole32! CoRevokeClassObject + 0xA3E
ole32! CoRevokeClassObject + 0x963
ole32! StgGetIFillLockBytesOnFile + 0xF872
ole32! WdtpInterfacePointer_UserMarshal + 0x80E
ole32! StgGetIFillLockBytesOnFile + 0xF792
RPCRT4! NdrGetTypeFlags + 0x1C9
RPCRT4! NdrGetTypeFlags + 0x12E
RPCRT4! NdrGetTypeFlags + 0x5A
RPCRT4! CreateStubFromTypeInfo + 0x2D7
RPCRT4! CreateStubFromTypeInfo + 0x318
RPCRT4! NdrConformantArrayFree + 0x2CB
RPCRT4! NdrConformantArrayFree + 0x20F
RPCRT4! I_RpcBCacheFree + 0x61C
RPCRT4! I_RpcBCacheFree + 0x43E
RPCRT4! I_RpcBCacheFree + 0x604
kernel32! GetModuleFileNameA + 0x1B4

+3
2

, ServicedComponent :

Out-Of-Process COM #/. Net?

+1

.Net Remoting .

0

Source: https://habr.com/ru/post/1703288/


All Articles