Use methods from Windows Service RRS feed

  • Question

  • Hi everybody!
    How can i create a Windows Service, that will have some important methods, then in my application i just call the service, or use this methods from that?

    If you get your question answered, please come back and Alternate TextMark As Answer.
    Web Developer

    Thursday, May 15, 2014 2:37 PM


All replies

  • I have an application that uses a WindowsService to monitor and direct message-flow between a number of discrete applications, all working together to control a number of laboratory instruments.

    The same code (or very nearly the same code) that executes as a WindowsService also exists as a WindowsForm app.   I use that conventional, WindowsForm app for development (it is SO much easier to debug), then once developed, the code is moved into the WindowsService.

    That is, I have two separate projects, one a WindowsForm app, one a WindowsService project.

    As mentioned, the code is nearly identical ... Some differences must exist due to the differing nature of the two projects.

    In this app, communication between the WindowsService and the supporting discrete applications is via Microsoft's MessageQueues.   In this app, no one actually calls a windowsService method ... rather,  they send a message to the Windows Service which is handled by the WindowsService (or possibly one of the other discrete applications).

    Thursday, May 15, 2014 4:25 PM
  • No, you can't make direct calls to methods hosted by a Windows service from a client program.

    However, you can have a Windows Service host a WCF service, And you can call methods through WCF service hosted by the Windows service from a WCF client program.


    • Marked as answer by Caillen Sunday, May 25, 2014 12:36 AM
    Thursday, May 15, 2014 7:20 PM
  • HI Nork ;

    what do you want to do with your methods?. I mean that you dont have to call windows services methods,if you want to call your method from your application.You can directly create your methods and you can use them.

    on the other hand, If you want do something without application.You can create some methods for windows services.So, You can easily call these methods  in some spesific time periods.

    Thursday, May 15, 2014 8:21 PM