I'm writing a c++ plugin (not managed) for the windows service - IAS.
The main code must be written in c#, so I wrote a c# module and registered it as COM Interop.
C++ plugin imports .tlb file generated by regasm.exe tool.
During the initialization of C++ plugin the CoCreateInstance is called and the main worker class is created, which is written
in C#. In test application, erevything works as expected.
However, the CoCreateInstance hungs when I try to run the whole plugin in windows service process. The most amazing thing is
that it works when I terminate(kill) the service process and start it again. In other words it fails only at first attempt to
start and works correctly after the service restart. The same problem presists when computer restarts. I also try to place the
CoCreateInstance call into the separate thread, to ensure that service start timeout is not exceeded. But it doesn't help.
Any advice will be greatly appreciated.