none
COM+ Component hosted by Windows Service in C# to control an external device RRS feed

  • Question

  • Hello,

    I have a Windows Service written in C# that controls a device connected to the computer by RS232 (gathers data and allows to control the device). It's named DeviceService and it's working properly. Now other applications use it by WCF services.

    But now I need to expose some of functionalities as COM+ Component, so applications in C++ can communicate with this windows service.

    (I know that there might be better ways to do this but that's the requirement that can't be changed. It must be via COM+).

     

    The problem is: when I create such a component in the DeviceService and activate it on the client it sees no data. For instance: static variables in Windows Service (DeviceService) return null for the component that is defined in the same assembly. Like it was another instance.

     

    What is the proper way to host a COM+ component inside a windows service? So they share the same context (static variables).

     

    (This topic was moved here from "Transactions Programming" Forum.

    Saturday, August 21, 2010 5:48 AM

Answers

  • Hi,

    Thanks for your post.

    Please take a look at the CSCOMService sample in the All-In-One code framework. It demonstrates an out-of-process COM/DCOM service in the form of Windows Service (EXE), which is implemented entirely in Visual C#.


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Marked as answer by SamAgain Thursday, August 26, 2010 6:46 AM
    Tuesday, August 24, 2010 6:31 AM