---
title: "Creating “Hello World” WCF Application"  
description: "In this article we will learn that how to create a simple WCF application which is Hello World application."  
author: "Anonymous User"  
published: 2011-08-11  
updated: 2021-01-20  
canonical: https://www.mindstick.com/articles/605/creating-hello-world-wcf-application  
category: "wcf"  
tags: ["wcf"]  
reading_time: 2 minutes  

---

# Creating “Hello World” WCF Application

In this article we will learn that how to create a simple WCF application which is Hello World application.\

##### Use .NET framework 4.0 and Visual Studio 2010 to create a WCF service application

1. Start Visual Studio 2010.
2. On the File Menu, point to new and then click on Project.
3. In the New Project dialog box expand visual c# node and then select WCF template.
4. From Project type window select [WCF service application](https://www.mindstick.com/articles/116/wcf-windows-communication-foundation-overview-and-sample-code-in-c-sharp-dot-net).
5. Type Name and Location of project and then click on OK button.

![Creating “Hello World” WCF Application](https://www.mindstick.com/mindstickarticle/a0e46f74-f76e-4804-a3ed-ccd0738c0d36/images/2f95c1c4-c622-44bb-882a-c2fcb0d5668f.png)

By performing these steps you can create a first WCF application with default template.

Now rename name of the file IService.svc to HelloWorld.svc and IService.cs to IHelloWorld.cs. This is not mandatory as I had done it on my sample you can put any name you want.

##### Creating ServiceContract

[ServiceContract] attribute is used to create a contract. For creating [WCF application](https://www.mindstick.com/articles/927/host-wcf-in-a-windows-service-using-tcp) you need to create a ServiceContract. We use following codes to create a ServiceContract.

\

```
using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.ServiceModel.Web;using System.Text;  namespace HelloWorldService{    [ServiceContract]//This attribute is used to create a ServiceContract.     public interface IHelloWorld //Create a interface which defines contract    {        [OperationContract]   //Use [OperationContract] attribute to declare a method which will be accessiable via client.        string GetMessage();    }  }  using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.ServiceModel.Web;using System.Text;  namespace HelloWorldService{     //Implement IHelloWorld interface and override GetMessage() method displlay a message.     public class HelloWorld :  IHelloWorld    {        public string GetMessage()        {            return string.Format("Wow! You have successfully created first WCF application.");        }    }} 
```

Now build application and then execute it by pressing F5 key. By performing these steps you will see following dialog box which is known as WCF Test Client window.

![Creating “Hello World” WCF Application](https://www.mindstick.com/mindstickarticle/a0e46f74-f76e-4804-a3ed-ccd0738c0d36/images/3da03982-a6b2-41ad-bb8c-56288be58adf.png)

Now double click on getMessage() label followed by click on Invoke button and you get desired result.

![Creating “Hello World” WCF Application](https://www.mindstick.com/mindstickarticle/a0e46f74-f76e-4804-a3ed-ccd0738c0d36/images/8165ba45-b35a-49e8-b4c5-1bf1f2211fb7.png)

\

---

Original Source: https://www.mindstick.com/articles/605/creating-hello-world-wcf-application

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
