Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application. An endpoint can be a client of a service that requests data from a service endpoint. The messages can be as simple as a single character or word sent as XML, or as complex as a stream of binary data.
This document covers technical details for creating Windows Communication Foundation (WCF) service application.
2: Steps for Creating WCF Service
2.1 Create WCF Service Application
• Open visual studio 2008(and above) and select new->Project->Visual C# -> WCF Service Application.
Give service name and click OK
• It will create one class i.e. ServiceName.svc.cs and interface i.e. Iservice.cs
• Add the method and logic as per user requirements within a class ServiceName.svc.cs
2.2 Browse Service to get Service address
• Run or browse the Service Application to get the service address. It will appear following screen
• Click on service (here service name is transaction.svc) to get the service address.
2.3 Add service reference in web app
• Right Click on web application and select Add Service Reference
• Add service reference in address field and click OK
• Now you can use WCF service in your application.
3. WCF Service Details:
3.1 WCF Service working:
In WCF service, user sends request through application and WCF service process that request and send response back to user application. Above figure shows WCF Service working.
WCF services are hosted using 3 different ways. They can be hosted in IIS or self-hosted or in services. WCF services are platform independent so they can be used in any programming languages. WCF services are easy to implement and access than soap services.