COM + component calling other COM + components - "Cannot load type",

I have two .NET assemblies that are registered as COM + components, and I test them from a regular test harness for a console application;

Dim objFirst As New MyFirstComponent() 'COM+ initialisation
Dim RC As Boolean = objFirst.GetValue()

The method call succeeds. This is the definition of MyFirstComponent;

<ProgId("MyFirstComponent")> _
<Guid("...")> _
<ClassInterface(ClassInterfaceType.None)> _
<Transaction(TransactionOption.Supported)> _
Public Class MyFirstComponent
    Inherits ServicedComponent
    Implements IMyFirstComponent

    Public Function GetValue() As Boolean Implements IMyFirstComponent.GetValue
        Dim objSecond As New MySecondComponent() 'COM+ initialisation
        Dim RC As Boolean = objSecond.GetValue()
        Return RC
    End Function

End Class

The moment MySecondComponent is initialized, I get a RemotingException with the following message:

Unable to load type "MySecondComponent", ..., Version = ..., Culture = neutral, PublicKeyToken = ... '

All assemblies are also strongly named. I cannot decide why I can successfully start a method call for the first component, but when it tries to load the second component later, it cannot resolve the type.

, "GetValue()" , , . , , COM + -, COM +.

, . , COM + - , COM + " ", . , , - (, GAC), - COM + - , . , GAC , .

. , . COM +, , . , GAC, , , COM- .

+2
3

, , . , - , , .

  • > COM + > YourComApplication

  • YourComApplication "".

  • " " , DLL.

  • application.manifest " COM + , . :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
</assembly>
  • - , , .

, , COM+. mulitple COM + .NET, , GAC.

+5

regasm COM. , /codebase, . . , .

+1

, , , , , PowerShell, , .

, , .NET Framework 4.5.1, PowerShell, , - 2.0. 4.0 5.0, .

0
source

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


All Articles