How get data from windows service (that is created by WCF-Communicate with windows service)?

StackOverflow https://stackoverflow.com/questions/22892581

  •  28-06-2023
  •  | 
  •  

Question

I created a windows service with wcf like this : Microsoft Sample Link

so my question is :

How can I get data from this windows service as client application (for example get some classes or array bytes) ?

Was it helpful?

Solution

Here are the high level steps:

  1. Create a C# Project for the WCF CLient. (can be Console App, Win Forms, Web Application etc.)
  2. Right click on Project References and Add Service Reference.
  3. Enter the WCF Service URL, the one used for the Windows Service.
  4. Visual Studio will create a proxy class for you along with necessary binding information.
  5. With the proxy in place & the Windows Service running, you can use the proxy as follows:

    using (ProxyNamespace.ProxyClass proxy = new ProxyNamespace.ProxyClass()) { var webMethodReturnType = proxy.SomeWebMethod1(); }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top