I have a website which need to handle bandwidth throttling using user's informations (so if the user is registered, he will be given a higher priority while streaming). To do so, I have created a Handler which using an ID, writes to the Response object the
bytes so that the maximum download rate is not exceeded. The handler needs to run until the download is complete or the user cancels the download. This causes the problem: while the handler is running, so the user is downloading someting, every other web page
is not reacheable. How can I handle this? I already tried to create an asynchronous handler... nothing changed. I am running the website on a IIS 7 machine (Windows Data Center Edition)
I'll bet you're using Session state in your app, right?
When requests come in, Session holds an exclusive lock so that other requests from the same session will not run in parallel and must run one after the other.
hkproj
0 Points
15 Posts
A request to a long-running handler blocks all requests to other pages
Apr 28, 2012 02:46 PM|LINK
Hi
I have a website which need to handle bandwidth throttling using user's informations (so if the user is registered, he will be given a higher priority while streaming). To do so, I have created a Handler which using an ID, writes to the Response object the bytes so that the maximum download rate is not exceeded. The handler needs to run until the download is complete or the user cancels the download. This causes the problem: while the handler is running, so the user is downloading someting, every other web page is not reacheable. How can I handle this? I already tried to create an asynchronous handler... nothing changed. I am running the website on a IIS 7 machine (Windows Data Center Edition)
handler httphandler bandwidth
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: A request to a long-running handler blocks all requests to other pages
Apr 28, 2012 02:49 PM|LINK
I'll bet you're using Session state in your app, right?
When requests come in, Session holds an exclusive lock so that other requests from the same session will not run in parallel and must run one after the other.
Many more reasons why session is bad.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
hkproj
0 Points
15 Posts
Re: A request to a long-running handler blocks all requests to other pages
Apr 28, 2012 02:52 PM|LINK
I didn't try your solution yet, but my handler is using Session (because it implements IRequiresSessionState or something like that ;-)
I'll try not using Session and let you know, thank you!
hkproj
0 Points
15 Posts
Re: A request to a long-running handler blocks all requests to other pages
Apr 28, 2012 04:00 PM|LINK
What about uploads? When I upload a file, all other requests must wait before being processed...
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: A request to a long-running handler blocks all requests to other pages
Apr 28, 2012 04:06 PM|LINK
If it's an HTTP request and the handler/page/controller is using session, then yep... that takes the lock.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/