halexic

halexic

  • NA
  • 9
  • 0

Windows Service - COM interoperability - Log off problem

Aug 20 2004 4:56 AM
Operating system is Windows 2003 Server. I have written C# Windows Service application and made my service dependent on other third-party windows service. In my C# windows service I import some third party COM objects (DLLs) that are written in C++ and I use these COM objects to open communication and to communicate with some hardware devices. I add these COM objects in C# by Adding a Reference and picking these DLLs so I can use these objects in my C# windows service. The third party windows service I depend on is used to coordinate opening these connections, sending and receiving data. After installing and setting my service to start automaticaly I have restarted PC and all work fine - third party service is started, then my windows service is started and in "OnStart" method my service opens connection to these hardware devices (using these COM objects) and keeps them opened. If I stop my service in "OnStop" method I release these connections (COM objects). I have a problem when I do Log off in Windows 2003 Server because when I do this my service is still started but service is not working anymore in right way because it losts somehow all opened connections to third-party hardware devices (and I need these connections because these devices interacts with my service so it doesn't "see" them anymore). If I Log on again and stop and start again my service it will work fine. Where I need to look to find something about my problem? Is it possible that I lost "the bridge" between .NET Framework and these COM components? I'm really confused.