Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the WFC Port configuration problem

Shulou Source: shulou.com Published: 2022-06-02 07:41:14 10月03日 Update

Editor to share with you how to solve the WFC port configuration problem, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

For some common network services, they all have a well-known port to match the WFC port. For example, the TCP port used by the FTP service is 23 for the TCP port of the 21th Telnet service, and so on. For the client usually does not care about the port used, just need to make sure that the port is * on the local machine, and such a port becomes a temporary port, which is generally between 1024 and 5000.

Generally speaking, a port can only be used by one application at a time. For WCF, when we host a service through a hosted application, a port is exclusively used by that application. How to use the same port for multiple homestay.

In the following WFC port example, I host two services, Service1 and Service2, through two different console applications, whose endpoint addresses share the same port: 9999.

When we run the WFC port hosting application for these two services, * will run normally, but for the second, the following AdressAlreadyInUseException exception will be thrown with the error message:

Using (ServiceHost serviceHost = new ServiceHost (typeof (Service1) {serviceHost.AddServiceEndpoint (typeof (IService1), new NetTcpBinding (), "net.tcp://127.0.0.1:9999/service1"); serviceHost.Open (); Console.Read ();}}

There is already a listener on the IP endpoint 127.0.0.1 IP 9999. Make sure that you have not tried to use the endpoint multiple times in your application, and that no other application is listening to the endpoint.

The above is all the contents of the article "how to solve the problem of WFC port configuration". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Port application program application service two endpoint homestay article problem configuration same content run different well-known generally speaking not much between examples Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MariaDB Shulou Technology Huawei OPPO Reno