January 7, 2015

WCF Project Templates in Visual Studio

Article is copying from my publish article at experts-exchange.com

Project templates provide the class structure and definition of service contracts, data contracts and other important features in Visual Studio for Windows Communication Foundation. Using these predefined template helps you to write a service with minimal code interaction and it will lead you to build more advanced services for your projects.

There are four different types of templates present in Visual Studio. The first two are the most commonly used to build, test and deploy SOA architectural applications.

1. WCF Service Library: 

The WCF Service Library project (C#) consists of three files; IService1.cs, Service1.cs and App.config. The WCF Service Library project (VB.Net) is consists of three files; IService1.vb, Service1.vb and App.config.

This type of project is suitable when we are focused on building the services first and deployment later.

  • IService File: This is the interface where the WCF service attributes are applied. In this file you place the definitions of data contract methods/operations.
  • Service File: This file is inherited from IService interface file and includes the implementations of defined interface's data contract methods/operations. 
  • Application Configuration File: In this file, you place the definitions of secure HTTP binding, endpoints of services and other important features.


2. WCF Service Application:
The WCF Service Application project (C#) is consists of four files; IService1.cs, Service1.svc, Service1.svc.cs and Web.config. The WCF Service Application project (VB.Net) is consists of four files; IService1.vb, Service1.svc, Service1.svc.vb and Web.config.

This type of project template creates a web site to be deployed to a virtual directory and hosts a service in that website.

  • Service Contract File (IService): The service contract interface file where you place the definitions of data contract operations.
  • Service Host File (Service1.svc) and Service Implemnetation File (Service1.svc.cs): This file is inherited from the service contract file and implements the data contract operations.
  • Web Configuration File: In this file, you place the definitions of secure HTTP binding, endpoints of services and other important features.

3. WCF Workflow Service Application:
The workflow (WF) service application can be accessed like a web service. It defines distinguish templates for XAML and other imperative programming models. We can create sequential and state machine workfow projects using these templates.


4. Syndication Service Application:
This type of project template provides the syndication functionality in an application in which you can easily work with feeds in ATOM, RSS and other custom formats as a WCF service. These are allowed you to read and create them and also expose them on service endpoints.

Now hopefully, you'll understand the different project templates in WCF which will be create as per the demand and the requirement.