ServicedComponent server activation permission denied

146 views Asked by At

I am trying to develop in C# a component that will be called and used out-of-proc by C++ client. For this I am trying to implement it as server activated ServicedComponent.

The component looks like below:

[assembly: ApplicationName("Sample COM")]
[assembly: ApplicationID("3967FB64-686C-4F93-B866-B011FEE9A6AA")]
[assembly: AssemblyKeyFile("SampleCOM.snk")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: Description("Testing ServicedComponents")]

namespace SampleCOM
{
    [ComVisible(true)]
    public interface ICalculator
    {
        double Add(double first, double second);
    }

    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("SampleCOM.Calculator")]
    [Guid("AA12A3DA-51A2-4F3D-90FF-E7C00E77800D")]
    public class Calculator : ServicedComponent, ICalculator
    {
        public double Add(double first, double second)
        {
            return first + second;
        }
    }
}

The code compiles fine (VS 2017) and I can register it using:

regsvcs /fc SampleCOM.dll

Now, I am trying to see how it works. For this, I am using old, good VB6.0 code:

Private Sub Command1_Click()
    On Error GoTo ErrorHandler

    Dim obj As SampleCOM.Calculator    
    Dim res As Double

    Set obj = CreateObject("SampleCOM.Calculator")

    res = obj.Add(1.2, 3.4)

    MsgBox "Done " & CStr(res)

    GoTo Cleanup   

ErrorHandler:
    MsgBox Err.Description

Cleanup:
    Set obj = Nothing
End Sub

And here I cannot make it work. CreateObject fails with Permission denied error on the client. It works fine if I switch to library activation but I need to have it out-of-proc, so server.

In the Event Log I can see the entry below:

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {AA12A3DA-51A2-4F3D-90FF-E7C00E77800D} and APPID {3967FB64-686C-4F93-B866-B011FEE9A6AA} to the user MYDOMAIN\ZUSER SID (S-1-5-21-126838783-1048989290-1062434389-134100) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.

I cannot find under DCOM Config the corresponding application {3967FB64-686C-4F93-B866-B011FEE9A6AA}.

There is only Sample COM app below COM+ Applications. But there, I am not sure what should be changed in order to make it work.

1

There are 1 answers

0
aguyngueran On

I ended up adding the following attribute:

[assembly: ApplicationAccessControl(false)]

which made Enforce access checks for this application disabled.