How do I host WCF services through TCP Ports, and how do I listen to it and consume services through these TCP ports?
That is, apart from the net.tcp binding, is there some way to host and consume using TCP ports?
Windows Communication Foundation (WCF) provides a new TCP-based network protocol (net. tcp://) for high-performance communication. WCF also introduces a new system component, the Net. TCP Port Sharing Service that enables net. tcp ports to be shared across multiple user processes.
In the Name column of the list of services, right-click the Net. Tcp Port Sharing Service, and select Properties from the menu. To enable the manual start-up of the service, in the Properties window select the General tab, and in the Startup type box select Manual, and then click Apply.
Open WCF Test Client. To open WCF Test Client, open Developer Command Prompt for Visual Studio and execute WcfTestClient.exe. Select Add Service from the File menu. Type http://localhost:8080/hello into the address box and click OK.
In WCF, you can host any service by yourself by creating an instance of the ServiceHost class, configure it with the correct endpoints and the service implementation you wish to expose, and call Open
on it. This is called self-hosting because you host the service (and its port listeners) from within your own application.
Alternatively, you can host your service in IIS, but you should be aware that while you can host WCF in IIS 6, it only allows you to host HTTP and HTTPS endpoints. If you want to host TCP endpoints in IIS (which is a good idea), you will need IIS 7.
Read more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With