In my ASP.NET MVC2 web app I have a page which goes off and gets results from a number of different web service feeds. These return times vary so I want to basically display them as they return after the page loads. I also want my user to be able to kick
of requests that can run concurrently with these other requests.
At the minute my page just seems to queue up the requests. The web service calls returning one at a time in the order they are called and then the user can kick of requests.
Is this a case for the asyncController or is there an easier/better way of working this?
The AsyncController isn't necessary for this. What you need to do instead is disable Session for the controller that's handling these AJAX requests; this will allow parallelization.
What are the conditions for locking the concurrent requests? Is User ASP.NET_SessionId
I disabled Session, Explicitly removed ASP.NET_SessionId cookie on client but still seems to be no concurrent requests allowed.
Even the Application_BeginRequest event is not executing if i put Thread.Sleep inside an action.
At which stage concurrent user locking is checked and what are conditions.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
At which stage concurrent user locking is checked and what are conditions.
If multiple requests with the same Session ID come in and at least one of the requests is marked Read+Write Session (this is the default behavior), the requests will be serialized. If multiple requests with the same Session ID come in and all of them have
Read-Only Session or Disabled Session (see the link above for the MVC Futures attribute to do this), they will be parallelized.
Note that even with this Session behavior, browsers vary by how many concurrent requests they will make to a single server. For example, IE in its default configuration doesn't make more than two concurrent requests to a single server. Other browsers (Firefox,
Chrome, etc.) will allow concurrent requests to the same server as long as the URL for each request is different.
Marked as answer by ricka6 on Jun 21, 2010 05:52 PM
If multiple requests with the same Session ID come in and at least one of the requests is marked Read+Write Session (this is the default behavior), the requests will be serialized. If multiple requests with the same Session ID come in and all of them have
Read-Only Session or Disabled Session (see the link above for the MVC Futures attribute to do this), they will be parallelized.
Note that even with this Session behavior, browsers vary by how many concurrent requests they will make to a single server. For example, IE in its default configuration doesn't make more than two concurrent requests to a single server. Other browsers (Firefox,
Chrome, etc.) will allow concurrent requests to the same server as long as the URL for each request is different.
Actually I was sending two requests to same url that's why browser was not sending concurrent request.
Thanks for clear me that Browser will not send concurrent request to same URL
flobabob
I was hoping I had just missed soemthing easy/obvious but that doesnt seem to be the case.
This way your request will parrelize for some requests and requests without parrelization still access the Session.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
flobabob
0 Points
2 Posts
Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 10, 2010 01:45 PM|LINK
In my ASP.NET MVC2 web app I have a page which goes off and gets results from a number of different web service feeds. These return times vary so I want to basically display them as they return after the page loads. I also want my user to be able to kick of requests that can run concurrently with these other requests.
At the minute my page just seems to queue up the requests. The web service calls returning one at a time in the order they are called and then the user can kick of requests.
Is this a case for the asyncController or is there an easier/better way of working this?
Thanks
Ajax and MVC AsyncController
levib
Star
7702 Points
1099 Posts
Microsoft
Re: Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 10, 2010 05:26 PM|LINK
The AsyncController isn't necessary for this. What you need to do instead is disable Session for the controller that's handling these AJAX requests; this will allow parallelization.
There's no built-in support for this in MVC 2 core, but it's in MVC 2 Futures. See https://blogs.msdn.com/b/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx for how to use what's built into Futures. The team is considering moving this into MVC 3 proper so that you'll no longer need Futures to use the feature.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 11, 2010 06:34 AM|LINK
What are the conditions for locking the concurrent requests? Is User ASP.NET_SessionId
I disabled Session, Explicitly removed ASP.NET_SessionId cookie on client but still seems to be no concurrent requests allowed.
Even the Application_BeginRequest event is not executing if i put Thread.Sleep inside an action.
At which stage concurrent user locking is checked and what are conditions.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
levib
Star
7702 Points
1099 Posts
Microsoft
Re: Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 11, 2010 07:36 AM|LINK
If multiple requests with the same Session ID come in and at least one of the requests is marked Read+Write Session (this is the default behavior), the requests will be serialized. If multiple requests with the same Session ID come in and all of them have Read-Only Session or Disabled Session (see the link above for the MVC Futures attribute to do this), they will be parallelized.
Note that even with this Session behavior, browsers vary by how many concurrent requests they will make to a single server. For example, IE in its default configuration doesn't make more than two concurrent requests to a single server. Other browsers (Firefox, Chrome, etc.) will allow concurrent requests to the same server as long as the URL for each request is different.
flobabob
0 Points
2 Posts
Re: Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 11, 2010 09:24 AM|LINK
I had read this but we are using the session and so cant set it to read-only or disabled!
Surely this is quite a common thing which a lot of developers would like to use?
I was hoping I had just missed soemthing easy/obvious but that doesnt seem to be the case.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Do I need to use asyncController to allow my user concurrent ajax requests?
Jun 11, 2010 10:47 AM|LINK
Actually I was sending two requests to same url that's why browser was not sending concurrent request.
Thanks for clear me that Browser will not send concurrent request to same URL
One way is to add this
protected void Application_BeginRequest()
{
if (Request.Url.AbsoluteUri.Contains("Home/About") && Request.Cookies["ASP.NET_SessionId"] != null)
{
Request.Cookies.Remove("ASP.NET_SessionId");
}
}
This way your request will parrelize for some requests and requests without parrelization still access the Session.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD