.NET ComException (0x800706BE) on Windows Server 2012R2 startup when querying Win32_Service
Hello,
when starting a service automatically on a Windows 2012R2 Server, during the startup of the server the service crashes with the following exception:
Stacktrace:
Exception: System.Runtime.InteropServices.COMException;
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
When the service is set to "Delayed Start" it works and stopping and starting on the running system works too.
During the service start the WMI-Query ("SELECT * FROM Win32_Service WHERE name like '%SERVICE%'") is made using the System.Management.ManagementObjectSearcher and the result set is looped to check if the service is already running.
Regards,
Bernhard