Host A WCF Service From A Client
> First of all for creating WCF Service in Visual Studio, please follow below link
>
How To Create A WCF Servcie In Visual Studio
> In order to consume this WCF Service, we needs to Host in IIS.
> And then we will call this Hosted WCF Service on the client Application.
> WCF Services are absolutely platform independent. We can call this in any language.
> Hosting a WCF Service on IIS is similar to Hosting a Website on IIS.
> You can find the content about Hosting a Web App On IIS in the following link.
>
Hosting A WCF Service On IIS From Visual Studio
Use A WCF Service From A Client
> After hosting the WCF Service, its time to Consume the Service in an Appliaction.
> 1. Copy the Hosted
WCf Service URL from IIS.
> 2. Then
Right Click on the Client Project and click on the
Add Service Reference link.
> On the newly opened window provide the
WCF Service Address and click
Go Button.
> This will fetch and list the
Services and
Operations from
IIS automatically.
> Provide a suitable name under
Namespace for the
Service Reference as in the above image.
> Now click the
OK Button for adding the WCF Service to the Solution as shown below.
> After adding the
WCf Service, now we can call the service on code as shown below.
> Create an
Instance of the
Service Reference and Invoke the
Preferred Method.
>
Created Instance would list all the methods in the
WCF Service.
> In the above example, we have called the
GetData method which returns a string value.
>
By this way we can call a WCF service in a Client Application.
Watch Video of this Content on Video Streaming