none
Windows Service talking between them (using proxy?) RRS feed

  • Question

  • is there a way that 2 windows service can talk between them (send receive classes?)

    except for using MSMQ?

    Wednesday, June 5, 2019 6:03 AM

All replies

  • Hi want 2 Learn,

    Thank you for posting here.

    For your question, you want to create a communication between two windows services. Based on my research, you could use TcpListener and TcpClinet.

    The following link may be helpful for you, you could have a look.

    https://stackoverflow.com/questions/5486917/communication-between-different-c-sharp-based-services

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Wednesday, June 5, 2019 8:35 AM
    Moderator
  • You might consider name pipes, the following example is window service and desktop but would think it would work with service to service too.

    https://github.com/webcoyote/CSNamedPipes


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, June 5, 2019 10:17 AM
    Moderator
  • You can use WCF service over named pipes between the two Windows services with one acting as the WCF service host, and the other one acting as the WCF client. 

    https://www.codeproject.com/Tips/876850/NetPipe-Binding-in-WCF-using-window-service

    You can use a DTO that has been marked as  a serializable data contract that is known by WCF service and clinet that can be sent between the WCF client and WCF service.

    https://en.wikipedia.org/wiki/Data_transfer_object

    http://www.mindscapehq.com/documentation/lightspeed/Building-Distributed-Applications-/Building-WCF-Services-using-Data-Transfer-Objects

    You can even do duplex using Named Pipes.

    https://sylvester-lee.blogspot.com/2014/08/wcf-duplex-named-pipe-binding.html

    You can create a classlib project to keep all the DTO(s) in and set reference to the classlib projract so that the WCF service and clinet know about the DTO(s). 

    Wednesday, June 5, 2019 12:14 PM
  • Any IPC can be used but let's clarify that you won't be sending true classes as classes don't transition that way (unless you were talking about remoting). You'll use data transfer objects to get data from process A to process B. Then each process can put that data into whatever type(s) it needs to do its work.

    Popular IPC mechanisms depending upon whether you're talking same machine or different (in order of my preference).

    - REST API (network)

    - Named Pipes (network)

    - Mapped Memory (local)

    - Clipboard (local)

    - WCF (network)

    - COM (local but DCOM allows network)


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, June 5, 2019 1:48 PM
    Moderator