How To Create A Proxy Class and Service EndPoint For WCF Service

Learn how to create a proxy class and service end point of your WCF service and use it in a client application.

Step 1: Run your WCF service and copy your url. 
 
(In my application, it is http://localhost:5174/MyService/MyService.svc )
 
Step 2: Open Visual Studio command prompt and write this command.
 
svcutil.exe http://localhost:5174/MyService/MyService.svc?wsdl
 
Step 3: The above command will create 2 files, one config file and another .cs file in VC folder shown in the command prompt path.
 
Step 4: Add this class files to the client application and also add config information to client application configuration file.
 
Step 5: Create object/proxy of service
 
Mysqervice.MysqerviceClient client=new Mysqervice.MysqerviceClient();
 
Step 6; Call method of WCF Service
 
int result= client.Add(5,7);
//do with result as your need.
 
Step 7: Close the client Proxy
 
client.Close();
 
New to WCF Services, start here: Create a WCF Service Using ASP.NET And C#