Introduction
In this article, we are going to use netTcpBinding in WCF.
Advantages of using Net.Tcp are as follows:
1) It can be used for high performance communication.
2) Net.Tcp Port sharing service enables net.tcp port to be shared across multiple user processes.
Lets go through this application step by step
Step1:
In this application, we are going to use Console Application. Open VS2008>New>Project>Console Application>Select language as c#>give the name of the project.
Step2:
Give the Reference to System.ServiceModel. Now lets write our ServiceContract,OperationContract and so on.
It just prints the value whatever we enter.
Step3:
Step4:
Now lets write the servicehost to our application.
Step5:
Now we are using a tool called svcutil.
You need to type in VS command Prompt like this
svcutil /out:proxy.cs /config:app.config "http://localhost:8025/Service"
It will generate proxy.cs and app.config.
Step6:
Now lets create a client application. New>Project>Console Application>give the name.
Copy and paste the proxy.cs and app.config from the particular location and paste into client application.
Step7:
Now give a Reference to System.ServiceModel. Then write these of lines in the Program.cs
Step8:
Now lets run this application
I hope you people like this application. Thank you.
If you like this article, subscribe to our
RSS Feed. You can also
subscribe via email to our Interview Questions, Codes and Forums section.