473,811 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making 10 POST requests from ASP.NET asynchronously

Hi all,

Is it possible to make 10 POST requests from ASP.NET asynchronously? I have
been working on this problem for a few days now, and I seem to keep running
up against IIS limitations. Basically here's the process as it works now
(synchronously) :

Person visits mywebsite.com and fills out a form
mywebsite.com POSTs one request to providerwebsite .com
mywebsite.com receives response
mywebsite.com POSTs a second request to providerwebsite .com
mywebsite.com receives response
....
mywebsite.com POSTs a tenth request to providerwebsite .com
mywebsite.com receives response

What I would like to happen is (asynchronously ):

Person visits mywebsite.com and fills out a form
mywebsite.com POSTs one request to providerwebsite .com
mywebsite.com POSTs a second request to providerwebsite .com
mywebsite.com receives a response to first request
....
mywebsite.com POSTs a tenth request to providerwebsite .com
mywebsite.com receives a response to ninth request
mywebsite.com receives a response to tenth request

The above is just an example - the responses should be able to arrive in any
order asynchronously. The problem is that each request can take up to 800
ms to respond, times 10 synchronous requests = 8 seconds... way too long...
The idea is that if I can send all ten requests asynchronously, the results
should start being returned much faster.

Is this even possible with ASP.NET and IIS?
Nov 14 '06
14 2558
"Mike C#" <xy*@xyz.comwro te in message
news:8b******** ********@newsfe 12.lga...
>
"John Saunders" <john.saunder s at trizetto.comwro te in message
news:u9******** ******@TK2MSFTN GP03.phx.gbl...
>"Mike C#" <xy*@xyz.comwro te in message
news:y6******* ******@newsfe11 .lga...
>>Hi all,

Is it possible to make 10 POST requests from ASP.NET asynchronously? I
have been working on this problem for a few days now, and I seem to keep
running up against IIS limitations. Basically here's the process as it
works now (synchronously) :

It is an IIS limit, as you say. It has nothing to do with ASP.NET.

The only ASP.NET relation is that you probably aren't calling Dispose on
your proxy objects, so you're not closing the connections.

John

I'm properly disposing of everything, so it falls back to IIS? Thanks.
It still has nothing to do with IIS, especially not on Windows Server 2003.
IIS is not involved - the network message goes straight from HTTP.SYS into
the ASP.NET worker process (w3wp).
Nov 16 '06 #11
Thus wrote Mike C#,
Thus sayeth Joerg Jooss,
>That is not likely -- the processing time for an individual request
does not improve by a client-side optimization. If resource
contention comes into play, it may even get worse. Yet, the overall
processing time for the page that kicks off those 10 requests should
be reduced unless you have a severe bottleneck in your system (such
as a deadlock).
I'm not trying to reduce the processing time for individual requests.
That is a constant I have no control over, like the speed of light. I
am trying to reduce the load time of my page by making 10 requests
asynchronously instead of 1 request...wait. ..1 response...1
request...wait. ..etc. synchronously.
>>Is this even possible with ASP.NET and IIS?
The 10 connections limitation only applies for non-server Windows
versions. It is not an IIS issue per se.
I ran into this particular problem on Windows Server 2003. I'm told
by a co-worker that there are some limitations built into the HTTP
standard which may be the root of my problem. He also suggested there
is some registry setting to get around it, but he couldn't tell me
where he found this information, so I'll keep Googling it.
Ah, silly me. Forgot that all these requests access the same site.

Yes, HTTP 1.1 recommends to limit the number of persistent and non-persistent
connections to a site to 2 and 4 respectively. In ASP.NET, this value is
10 by default.

You can override this value using ServicePointMan ager.DefaultPer sistentConnecti onLimit
or in config:

<configuratio n>
<system.net>
<connectionMana gement>
<add address = "*" maxconnection = "2" />
</connectionManag ement>
</system.net>
</configuration>

BTW, the registry keys you're looking for have been described in microsoft.publi c.dotnet.langua ges.csharp
just two days ago.

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Nov 16 '06 #12
Thus wrote Joerg,

[...]
Ah, silly me. Forgot that all these requests access the same site.
Geez,

make that "requests originate from the same site".

--
Joerg Jooss
ne********@joer gjooss.de
Nov 16 '06 #13

"John Saunders" <john.saunder s at trizetto.comwro te in message
news:uK******** ******@TK2MSFTN GP03.phx.gbl...
It still has nothing to do with IIS, especially not on Windows Server
2003. IIS is not involved - the network message goes straight from
HTTP.SYS into the ASP.NET worker process (w3wp).
I gave up on it and created a separate class that calls WinHTTP directly.
It's a lot more work, but it's fasssst.

Thanks.
Nov 17 '06 #14

"Joerg Jooss" <ne********@joe rgjooss.dewrote in message
news:94******** *************** ***@msnews.micr osoft.com...
Ah, silly me. Forgot that all these requests access the same site.

Yes, HTTP 1.1 recommends to limit the number of persistent and
non-persistent connections to a site to 2 and 4 respectively. In ASP.NET,
this value is 10 by default.

You can override this value using
ServicePointMan ager.DefaultPer sistentConnecti onLimit or in config:

<configuratio n>
<system.net>
<connectionMana gement>
<add address = "*" maxconnection = "2" />
</connectionManag ement>
</system.net>
</configuration>

BTW, the registry keys you're looking for have been described in
microsoft.publi c.dotnet.langua ges.csharp just two days ago.
Thanks Joerg. I went ahead and wrote a class to access WinHttp functions
directly. It's hella fast, and works great.
Nov 17 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
17744
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I need to make a socket connection through it. The reason (with code example) is as follows : I am hacking "Tiny HTTP Proxy" by SUZUKI Hisao to make an http proxy that modifies URLs. I haven't got very far - having started from zero knowledge of...
1
3808
by: Brad | last post by:
A long-time JScript/IE programmer friend of mine shared a technique with me recently that puzzles me. He has a series of functions that perform POSTs, with each function returning a dummy value. He has a dummy variable in the calling code to catch it. He said that by both returning and catching this dummy value, the POSTs perform synchronously, whereas if there were no values caught in the calling code, they would perform asychronously....
2
1361
by: Christopher Benson-Manica | last post by:
Is there a more crossbrowser-friendly means to make HTTP requests using script than the XML methods? I need to do this in IE 5.0, and it doesn't seem to have the ActiveX control that can make XML HTTP requests. I hope the answer will not be to roll my own HTTP protocol handler :) -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
2
3125
by: Robert Oschler | last post by:
I am working on a PHP 4 app that interacts with an external authorization server. The external server does "third-party" authorization of users. So I do the following: 1) Each of my PHP scripts has an include file (require_once) that checks to see if the current user has recently been authorized. 2) If not, the user is "handed off" to the external server. I do this by building the necessary URL for authorization and using refresh to...
3
2278
by: Yong | last post by:
I get a general network error when I try to make asynchronously call ExecuteNonQuery on long sql statements that run in parallel. Here is the background info on what I'm trying to accomplish: I have a sql file with two long T-SQL batches, each of which contains about 50 thousand simple insert statments into 2 non-indexed tables. Batch 1 inserts into Table 1 and batch 2 inserts into Table 2, so they can run in parallel. I parse each...
34
3708
by: Asfand Yar Qazi | last post by:
Hi, I'm creating a library where several classes are intertwined rather tightly. I'm thinking of making them all use pimpls, so that these circular dependancies can be avoided easily, and I'm thinking of making all these pimpl class declarations public. Reasoning is that since only the code within the ..cc file will need to ever access them, why protect them in ways that would make access to them more difficult and obfuscated? What...
4
4604
by: rzimerman | last post by:
I'm hoping to write a program that will read any number of urls from stdin (1 per line), download them, and process them. So far my script (below) works well for small numbers of urls. However, it does not scale to more than 200 urls or so, because it issues HTTP requests for all of the urls simultaneously, and terminates after 25 seconds. Ideally, I'd like this script to download at most 50 pages in parallel, and to time out if and only...
14
10023
by: FMDeveloper | last post by:
Currently transitioning from a shared host to a dedicated server. The same code that works on the old server is not working on the dedicated server. It is a simple AJAX request like: <code> function createXMLHttpRequest() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) {
3
4479
by: Phillip B Oldham | last post by:
In my attempt to learn python in a weekend, I've fallen foul at line 10 of my second scripting attempt. Basically I'm writing a simple spider, but currently I'm unable to find any documentation on making HEAD requests using the urllib2 library to test whether a file exists on a remote webserver. I've checked the docs on urllib2 from docs.python.org, and unless I'm missing something there doesn't seem to be a way to do *any* request...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.