Search code examples
c#wcftcpwindows-serviceslan

Right way to specify base address in WCF service with net.tcp


Suppose I've one WCF service hosted in a Windows service running on a machine on LAN. I want to make this service to be consumed by applications running on other machines on same LAN. Further assume I've hosted WCF service in a Windows service using TCP. So the app config file will have the base address mentioned something like this:

<add baseAddress="net.tcp://localhost:8523/Service1" />

My question is will this service be accessed by clients over LAN though I've mentioned localhost? What is the right way to mention base address so that service could be consumed by clients on LAN? Is any arbitrary address is valid? If localhost is valid, which port shall I mention?


Solution

  • you need to specify the actual ip. i think localhost is just for the current machine. localhost is an alias for the default address 127.0.0.1