Wcf – Consume WCF Service Hosted in a Windows Service

installationwcfwcf-bindingwindows-services

I wrote the WCF Service and hosted in windows service. I need to know how to consume this windows service in my client application.


Note:

I wrote Net pipe binding service.


Edit:

How can I write the client application for net pipe binding?

Best Answer

You need to do a few easy steps:

  • start your Windows service hosting your WCF service
  • from within Visual Studio (2008 or higher), right-click on a project node in the solution explorer and choose "Add service reference"
  • enter the URL where your service can be reached

That's about all there is, really. Visual Studio will go to your running service, get all the metadata it needs (assuming you've enabled a MEX endpoint for metadata exchange), and will create a client proxy class for you to use to connect your client to your service.

Marc