title: How to create a HTTP request listener Windows Service in .NET
body: <p>I want to create Windows Service that acts as a HTTP listener and can handle around 500 clients. Are there any special considerations for this kind of service.</p>
  
  <p>I am a little confused between the HTTPListener class and the TCPListener class. Which one  to use for a Windows Service that will:</p>
  
  <ol>
  <li>Accept the client connection (around 500)</li>
  <li>Process client request</li>
  <li>Call another Http based service</li>
  <li>Return some value to the calling client</li>
  </ol>
  
  <hr>
  
  <p>This is what I am doing to start the listener.</p>
  
  <pre><code>    listener = new HttpListener();
      listener.Prefixes.Add("http://localhost:8080/");
      listener.Start();
      listener.BeginGetContext(new AsyncCallback(OnRequestReceive), listener);
  
  private void OnRequestReceive(IAsyncResult result)
  {
       HttpListener listener = (HttpListener)result.AsyncState;
       // Call EndGetContext to complete the asynchronous operation.
       HttpListenerContext context = listener.EndGetContext(result);
       HttpListenerRequest request = context.Request;
  } 
  </code></pre>
  
  <p>Will I be able to handle N clients simultaneously?</p>