Consuming WCF service in asp.net application
In this article we will see how to consume WCF service in Asp.net application step by step.
1. Right click on the Asp.net application References and select Add Service Reference
2. In the Add Service Reference dialogue box, Click on Discover and Select Services in Solution.
3. Give Namespace as WCFServiceReference and click on OK.
4. WCF service reference will be add to solution under Service References.
5. Bindings and endpoint will be added to web.config as shown below.
6. Add a button & lable in ConsumeWCF.aspx
7. Implement btnGetTime_Click method in ConsumeWCF.aspx.cs
Where WCFServiceReference is service reference and created service client object objWCF. Now we can call the GetDateTime() method of WCF Service like objWCF.GetDateTime();
Download sample project : Download