Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 153739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:51:16+00:00 2026-05-11T09:51:16+00:00

I want to create Windows Service that acts as a HTTP listener and can

  • 0

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.

I am a little confused between the HTTPListener class and the TCPListener class. Which one to use for a Windows Service that will:

  1. Accept the client connection (around 500)
  2. Process client request
  3. Call another Http based service
  4. Return some value to the calling client

This is what I am doing to start the listener.

    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; }  

Will I be able to handle N clients simultaneously?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:51:17+00:00Added an answer on May 11, 2026 at 9:51 am

    If you need to be able to highly responsive HttpListener will not scale very well (you cannot accept more than one connection at a time). But for small scale use, being careful to get context and write the response asynchronously it can work.

    EDIT: Appears I misunderstood HttpListener‘s ability to accept connections. You can accept multiple connections concurrently (see comment). However IIS’s other facilities to host code would avoid reinventing the wheel. So unless there are very specific requirements that preclude IIS, why not take the easy path?

    For serious use, use IIS, creating an Http Handler (a class that implements IHttpHandler or IHttpHandlerFactory, or even an IHttpAsyncHandler) to handle the requests (this is the underlying type that implements .aspx et al).

    The right solution really depends on what you mean by ‘handle around 500 clients’: one at a time or all at once?

    Based on the comment answer: 500 at once, and noting that the processing, in step 3, includes another HTTP call, I doubt using HttpListner will be able to handle the load without ensuring every operation is asynchronous (getting context and request, performing the onward HTTP request and then sending the response)… which will lead to some more difficult coding.

    Unless there is a very good reason to avoid IIS, using IIS will be easier as it is designed to support large scale client request loads with rich functionality, whereas HttpListener ‘Provides a simple, programmatically controlled HTTP protocol listener.’.

    EDIT: Expanded based on more details of load.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a windows service that would start before user can login.
Is it possible to create a C# EXE or Windows Service that can process
This may already exist I hope. I want to create a Windows service that
At work, I want to create a WCF Windows Service that runs on a
I want to create bat file that will install windows service, passed as a
I want to create a Windows Service that tracks if the A/C power adapter
I want to create windows service which recieves via some queue tasks to run
I want to create a companion Windows desktop program for my app. One that
I want to create applications in windows that has complete portability (within windows OSes
I want to create a powershell script that creates a shortcut in the windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.