There are couple of different options available to create proxy class for a WCF service in .Net. First one is to use “Add Service Reference” option available in visual studio and the second option is to use svcutil.exe utility. Although “Add Service Reference” option also invoke this utility implicitly but you can also go to visual studio command prompt and use this utility to generate proxy code that you can use in your client application.
First of all to generate proxy class we need to have our service up and running. So before using this utility make sure that your service is running without any issue.
After verifying the service status go to Visual Studio Command Prompt and run the following command.
svcutil http://localhost/MyService/Service1.svc /Language=vb
/t:Code /out:MyServiceProxy.vb /config:MyServiceProxy.config
In above command you should replace the service URL (http://localhost/MyService/Service1.svc) with the URL of your service. Since my services is developed in VB.net so I choose to generate the proxies in the same language by using /Language=vb flag. /t:code will specify that the out put should be generated as code. And /out:MyServiceProxy.vb /config:MyServiceProxy.config parameters will tell the utility to name the files as specified in these parameter values. After you run the command, tool will generate the output file and config file.
After that just include the MyServiceProxy.vb file into your project and open the MyServiceProxy.config file and copy the entries to your web.config file. You may also need to update the MyServiceProxy.vb file and update the namespace as per the one that you are using in your project. After that you can easily reference the service in your code and call the operations.