WCF Example in C#

WCF Example

WCF1.jpg

Click OK Button.

WCF2.jpg

Click ok

After that your project looks like following image.

WCF3.jpg

Open IService1.cs

//Make your method for adding two number

        [OperationContract]

        int Add(int a, int b);

 WCF4.jpg

After that you have to call this interface into service.svc.cs

public int Add(int a, int b)

{
return
a + b;
}

WCF5.jpg

Your services is ready for consume.press F5

You have to see following window.

WCF6.jpg

In your web application

AddServicerefrence

WCF7.jpg

WCF8.jpg