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

  • SEARCH
  • Home
  • 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 7961129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:56:52+00:00 2026-06-04T04:56:52+00:00

i am after some advice/strategy on limiting http requests when consuming multiple web services.

  • 0

i am after some advice/strategy on limiting http requests when consuming multiple web services. I feel i could do this if the requests were happening synchronously, but they are asynchronous and think i should try to perform the limit logic in a way that i wont block.

Due to the web app consuming multiple web services there will be different limits for different requests. I was thinking something like this, but aren’t sure how to proceed in a no blocking manner:

request method:

public static Task<string> AsyncRequest(string url, enum webService)
{
    using(LimitingClass limiter = new LimitingClass(webService))
    {
       //Perform async request
    }
}        

In the LimitingClass it will have logic like checking the last request for the given webservice, if it violates the limit then it will wait a certain amount of time. But in the mean time if another request comes in to a different webservice then i dont want that request to be blocked while the LimitingClass is waiting. Is there anything fundamentally wrong with the above approach? Should i open up a new thread with each LimitingClass instance?

Some pseudo code would be great if possible.

Many Thanks

UPDATE:

This is a simplified version of my current request method:

public static Task<string> MakeAsyncRequest(string url, string contentType)
{
    HttpWebRequest request = //set up my request

    Task<WebResponse> task = Task.Factory.FromAsync(
        request.BeginGetResponse,
        asyncResult => request.EndGetResponse(asyncResult),
        (object)null);

    return task.ContinueWith(t => ReadCallback(t.Result));
}

I just want to wrap this in a using to check the limits and which doesnt block other requests.

  • 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. Editorial Team
    Editorial Team
    2026-06-04T04:56:53+00:00Added an answer on June 4, 2026 at 4:56 am

    So how are you limiting an access to resource without blocking ?

    I think you need to look at Semaphores – they allow to limits the number of threads that can access a resource or pool of resources concurrently.

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

Sidebar

Related Questions

After doing some research I need some advice. This is a small project which
Just after some advice regarding this database design situation. So I have two tables
I am after some advice and pointers on integration testing for a web app.
after some advice regarding a problem i am getting using a linux based piece
Summary I am after some advice on the easiest way to analyze simple data
I'm after some design advice. I'm working on an application with a fellow developer.
I'm a newbie to Unit Testing and I'm after some best practice advice. I'm
After some advice. I have a client wishing to have an app which lets
I'd like some advice on how to organise the files for a database-driven web
After some advice on how to clear markers on googlemaps, I have a map

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.