Docker Community Forums

Share and learn in the Docker community.

COM Firewall object creation fails with Error Creating an instance of the COM component with CLSID {304CE942-6E39-40D8-943A-B913C40C9CD4}

Host: Windows Server 2019 Version 1809. OS Build 17763.1697
Image OS used: mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
Docker Desktop version 20.10.2, build 2291f61

I’m running windows console app from the container and it crashes. App creates firewall COM object and returns true or false depending on windows firewall state enabled/disabled. The crash happens when creating firewall instance object.

This console app is working just fine on the host machine. There is no crash when enabling/disabling firewall. However when I run the same app on container it crashes.

I know there are other ways how to check if firewall is enabled or disabled. The main reason why the code is written that they is by troubleshooting another issue I found when running Visual Studio 2019 Test agent configuration tool TestAgentConfig.exe on Container. It fails with the same COM component CLDIS error when checking state of windows firewall).

Do I missing any configuration on docker/container/host to make this work?

Full error:

Method Main failed with error Creating an instance of the COM component with CLSID {304CE942-6E39-40D8-943A-B913C40C9CD4} from the IClassFactory failed due to the following error: 800706d9 There are no more endpoints available from the endpoint mapper. (Exception from HRESULT: 0x800706D9).
stack at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

  • at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)*
  • at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)*
  • at System.Activator.CreateInstance(Type type, Boolean nonPublic)*
  • at System.Activator.CreateInstance(Type type)*
  • at ConsoleAppFirewall.Program.Main()*

Source code snippet:

private const string clsidFireWall = "{304CE942-6E39-40D8-943A-B913C40C9CD4}";
        private static void Main(string[] args)
            {
            try {
                Type tpNetFirewall = Type.GetTypeFromProgID("HNetCfg.FwMgr", false);
                INetFwMgr mgrInstance = (INetFwMgr)Activator.CreateInstance(tpNetFirewall);
                bool blnEnabled = mgrInstance.LocalPolicy.CurrentProfile.FirewallEnabled;
                if (blnEnabled==false) {
                    Console.WriteLine("Firewall Disabled");
                    } else {
                    Console.WriteLine("Firewall Enabled");
                    }

                } catch (Exception e) {
                Console.WriteLine(String.Format("Method CheckFirewall1 failed with error {0}", e.Message));
                Console.WriteLine(String.Format("stack {0}", e.StackTrace));
                }
            }