In ASP.NET CORE 2.0 I have this behavior: I send two AJAX requests from the browser, the first request to one action (action1 this is an async action) and the second request to other action (action2). While the server is processing the first request, the second request is queued, then when the first request hits the "await" instruction into the action 1, immediately the action 2 start processing the second request and the first request become queued. And this is the expected behavior, but then If I try this in ASP.NET 4.6 I have this behavior: When the first request hits the "await" instruction, the second request keep queued and have to wait until the first action finish the entire processing, for the second action to receive the second request.
This is my server side code
[HttpPost]
public async Task<JsonResult> LongRunningAction(HttpPostedFileBase file)
{
for (int i = 0; i < 100; i++)
{
await Task.Delay(300);
}
return Json("finish");
}
[HttpPost]
public ActionResult ParallelAction()
{
return this.Content("result");
}
This Is my js:
startParallelRequest();
startLongRunningRequest()
function startLongRunningRequest(){
$.ajax(
{
url: "/mycontroller/LongRunningAction",
data: null,
processData: false,
contentType: false,
type: "POST",
success: function () {
stopParallelAction();
}
}
)
}
var intervalId;
function startParallelRequest() {
intervalId = setInterval(
function () {
$.ajax(
{
url: "/mycontroller/ParallelAction",
data: null,
processData: false,
contentType: false,
type: "POST",
success: function () {
}
}
);
},
1000
);
}
function stopParallelRequest() {
clearInterval(intervalId);
}
What i want to get is a response from the parallel action in each iteration of the loop. This behavior works fine in an ASP.NET 2.0 project but not in ASP.NET 4.6. Thanks In advance.