0

On our site we found that when user awaits for page loading, try of opening another page will stuck until the first one will load.

For imitation we created a test page with a button, click on which performs two simultaneous AJAX calls using XMLHttpRequest. Running it multiple times and analysing the process give us a clue — MVC performs one call after another, but not same time.

I always thought wrong or it's just question of an incorrect configuration?

MVC5 and different versions of IIS.

Update: turned testing action into async as show below:

public virtual async Task<JsonResult> Test3()
        {
            await Task.Run( () => System.Threading.Thread.Sleep(6000));
            return Json(new { success = true });
        }

Situation is the same (and looks like T4MVC not works with async actions).

Troll the Legacy
  • 675
  • 2
  • 7
  • 22
  • Tasks are (still) not threads and async is not parallel: https://www.wintellect.com/tasks-are-still-not-threads-and-async-is-not-parallel https://code-maze.com/csharp-delegates/ – jazb Nov 23 '18 at 07:12
  • 1
    You might be affected by [session state's requirement for exclusive access](https://stackoverflow.com/questions/4428413/why-would-multiple-simultaneous-ajax-calls-to-the-same-asp-net-mvc-action-cause). Also note Darin's comment on using `cache: false` in your AJAX call. – sellotape Nov 23 '18 at 07:49
  • The same situation it not only on ajax. Setting the SessionState to disabled crashed all web application in a such violent way — under SO died NLog, few other things and our security logic, while setting to read-only kinda helps, but needs additional testing. – Troll the Legacy Nov 23 '18 at 09:04
  • Thank thou @sellotape, read-only session state works, so thou can write it as an answer. – Troll the Legacy Nov 27 '18 at 05:42

0 Answers0