0

I have an MVC5 - application which has multiple Controllers. These Controllers usually return an ActionResult (containing Json-Data)

Now I got two problems:
First: These Operations take very long
Second: I need to use a Session, so the usual hints disabling Sessionstate do not work.

Now a single call blocks a following call.

Is there a way to get around this issue?
Is this blocking Per-IP or gets everyone blocked?

(I plan to host that application on Azure; Maybe that could be a road to a possible solution to use "something" different than the Session, if needed)

(Update): To make a bit clearer what the problem is: I am trying to get around the following issue but still need a Session (or something simular):

ASP.NET MVC 5 concurrent requests are queued even with disabled Session

Example Controller Code:

[RoutePrefix("api/user")]
public class UserController:Controller {

  [Route("getname/{userid}")]
  public ActionResult GetName(int userid)
  {
    return Content(new User().GetById(userid)); // takes a very long time
  }
}
Community
  • 1
  • 1
Ole Albers
  • 8,715
  • 10
  • 73
  • 166
  • 1
    I'm not quite sure what you are asking ... perhaps a code sample might help explain the problem? ... MVC5 and sessions work fine together. – War May 04 '16 at 14:05
  • They do. But they prevent PARALLEL execution of Controller Action. I added a link to another SO-Question to make this clearer – Ole Albers May 04 '16 at 14:06
  • Possibly related: [Think twice about using session state](https://brockallen.com/2012/04/07/think-twice-about-using-session-state/). – NightOwl888 May 04 '16 at 14:12
  • Sadly the Session is part of the SharePoint Authentication Library (CSOM) needed in my case. My custom code does not use Session at all – Ole Albers May 04 '16 at 14:14
  • I'm confused ... public Task Foo() { ... } <-- async out of the box, and I can call that 100 times at the same time on many threads, nothing is blocked and this should have no impact on other requests. – War May 04 '16 at 14:19
  • Ok, I am a bit confused....one thing I need to clear out first, even without the debugger attached, do you get the same behaviour in Chrome Dev-tools??? – SamGhatak May 04 '16 at 14:21
  • @Darth_Wardy Not in my case. And according to other questions here on SO it is the "normal" behaviour that requests get queued when Sessions are enabled: http://stackoverflow.com/questions/2326817/asp-net-mvc-and-ajax-concurrent-requests – Ole Albers May 04 '16 at 14:22
  • @Darth_Wardy I did not use Task but ActionResult until now. Maybe that is the way to go. Need to check if this works in combination with the UserAuthentication-Attribute which happens before the controlelr action – Ole Albers May 04 '16 at 14:36

0 Answers0