WCF listen on the base address of anyip

I want my service host to have the base address of any IP address so I tried this

new ServiceHost(typeof(LoggingController),new Uri("0.0.0.0"));

and this gives me an invalid URI format

Does anyone know how to write this?

Well, I tried to access it from outside my local lan, and it didn’t work, I made a little test software using tcpiplistener, and I started listening to the same port, and I set the base address of the tcpip protocol to anyip and small the test software worked, so I realized that all I have to do is install the same for Webservice -

TcpListener tcpListener = new TcpListener(IPAddress.Any,10021);

This works, which also means that my system administrator has done his job of providing access to the port / server from the outside, now my web service should not work! it works, but I can’t access it from the outside, I can access it from the same computer if I run the client on the same computer

+3
source share
2 answers

The following code works for me in a similar situation:

Uri baseAddress = new Uri("net.tcp://0.0.0.0:8080/MyService");
host = new ServiceHost(typeof(MyServer), baseAddress);
+4
source

. webservice Windows- , - - / - . , ( ). , WebHttpBinding, . , !

+1

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


All Articles