Sql Session Status; Unable to insert duplicate key in object 'dbo.Sessions'

We have an ASP.net MVC5 web application hosted on Azure that automatically scales when there is a high load on multiple instances. After reading about scaling Azure, we changed from serving an In-Proc session to serving a SQL session ( https://www.red-gate.com/simple-talk/cloud/platform-as-a-service/managing-session-state- in-windows-azure-what-are-the-options / ) using the generic Microsoft Asp.net.AspNet.Providers package nuget.

After clicking on live, we noticed errors with SQL insert error registered in ELMAH, showing errors creating session records in the Sessions system table. They seem to be caused by AJAX calls made by Angular to compose the page. Could this be due to several simultaneous challenges and some strange race condition? For us, there is no code for debugging or management, since all this is hidden in the vendor package, but simply editing in "web.config" to enable this.

I recently saw examples of this event on my local host during development, so I don’t think it has to do with multi-server load balancing and something more fundamental with the structure of the application, or at least how it makes its AJAX calls?

+5
source share

Source: https://habr.com/ru/post/1275992/


All Articles