When creating a WCF service using NetTcpBinding, use the "localhost" endpoint or the host name of the computer?

I have a WCF service that uses NetTcpBinding and runs on a windows service. Remote clients connect to this service. So far, I have defined the endpoint for using "localhost".

If the host computer has several network adapters, will it receive messages on all adapters?

Would it be better to assign the hostname of the machine to the endpoint instead of "localhost"?

What are the advantages / disadvantages?

+3
source share
2 answers

You can use System.Environment.MachineName

:

new EndpointAddress(new UriBuilder {Scheme = Uri.UriSchemeNetTcp, Port = port, Host = System.Environment.MachineName}.Uri);
+1

, , localhost, URI :

net.tcp://0.0.0.0

, , .

0

Source: https://habr.com/ru/post/1721930/


All Articles