Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the WFC Port configuration problem

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report