Basic WCF Service Step by Step

Datetime:2016-08-23 04:33:58         Topic: WCF          Share        Original >>
Here to See The Original Article!!!

  • IService – Service Interface File
  • Service.SVC – It’s the file where Service code is available and similar to .asmx file of web service
  • Web.config – Configuration details where the Endpoint information are stored.


This is the file which has all the declaration and not definition if properties, here we call it as Contract in WCF and this helps for all the operations that happens with the service so named as “Operation Contract”.

Data Contract

Here the Data are to be transferred and processed with in service and they store the values, so in the WCF terminology they are called as “Data Contract”.
Where the each member of the Class i.e. the Data contract is called as “Data Member” and they are also to be decorated with the Attributes.


This is the main file for any of the WCF service where this file inherits the “IService” interface and implements all the method of the operation contract methods. Now, you can find two methods are implemented in the .SVC file.


In a WCF application Web.config files plays another important role, as the application will have various set of “ABC”- Address, Binding and Contract and all those are defined in the web.config files.

Sample Config Entries

Execute the Application using WCF Test Client:

The WCF Test Client is one of the best tools for the developers to test the WCF application. Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that enables users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.

This file will be available in following location,

C:\Program Files (x86)\Microsoft Visual Studio (Your Version Here)\Common7\IDE

Step 3:

Set the Service.SVC file as the “Start up page” and execute the application, so automatically the WCF Test client window will be displayed.

Step 4:

WCF Test Client Execution:

Here all the Methods will be displayed and also the appropriate method details will be displayed on the right side pane when you select the methods, which are readily testable.

Step 5:

“Invoke” method will execute the method with the input value and gives us the response from the service and you can view the response in the application output section of WCF test client.

Step 6:

Now you have successfully created the WCF application and also tested using a “WCF TEST CLIENT”, to be real on other part just think how many lines of code you have typed for this application execution. You have done a sample without writing a single line of code and that’s was ease usability of the Visual studio.

About List