title: WCF Net.Tcp binding to a localhost address will pop up Windows Firewall dialog, why?
body: <p>I have a WCF Self-Hosted service with Net.Tcp binding configured. This service only needs to listen to a localhost port, so my service configuration code is as below:</p>
  
  <pre><code>var endpointBaseAddressUri = new Uri(string.Format("net.tcp://localhost:{0}/{1}", availableTcpPort, parentID));
  using (ServiceHost host = new ServiceHost(typeof(RenderOperation), new Uri[] { endpointBaseAddressUri }))
  {
          var binding = new NetTcpBinding();
          binding.MaxReceivedMessageSize = MAXBUFFER;
          binding.ReaderQuotas.MaxArrayLength = MAXBUFFER;
          binding.ReaderQuotas.MaxStringContentLength = MAXBUFFER;
          host.AddServiceEndpoint(typeof(IMyService), binding, guid);
  
      host.Open();
  
      // Other logic goes here
  }
  </code></pre>
  
  <p>The problem is that, when the service is started with Administrator account, everything goes well. However if I logged on to Windows and start this WCF service with a regular account, following Windows Firewall dialog appears:</p>
  
  <p><a href="https://i.stack.imgur.com/ibTsP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ibTsP.png" alt="enter image description here"></a></p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Since localhost is a loopback address, why Windows Firewall dialog still appears asking permission on a loopback address?</li>
  <li>Is this the Windows Firewall setting related to the Net.TCP Listener Adapter? What is the best practice of Windows Firewall settings to get rid of this dialog?</li>
  <li>Is there any workaround to not allowing the dialog to appear when a regular user is starting the WCF service?</li>
  </ol>
  
  <p>Thanks!</p>