Load balancer without session stickiness problem

Saturday, December 28, 2024 11:43:33 PM
  • Posted: Monday, April 12, 2021 8:40 AM
  • 7
Hello there,

We share servers with load balancer. Our load balancer is working without session stickiness. It causes a mess in the sessions. We can see the following error from the logs. Has any improvement been made on this subject?
The version we used is 4.70

Thanks in advance for your support.

Log;

Category: Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery
EventId: 7
RequestId: 800006a4-0002-a600-b63f-84710c7967bb
RequestPath: /login
SpanId: |b53394da-48e51c8d8326815d.
TraceId: b53394da-48e51c8d8326815d
ParentId:
ActionId: 24b3bb6a-8656-4f1a-93ea-c67a9f3a95eb
ActionName: Grand.Web.Controllers.CustomerController.Login (Grand.Web)

An exception was thrown while deserializing the token.

Exception:
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
---> System.Security.Cryptography.CryptographicException: The key {d043bf1d-8230-4c2a-9642-986739a95772} was not found in the key ring.
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
   at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext)
0
  • Posted: Monday, April 12, 2021 12:10 PM
  • Team
  • 153
Hi,

In folder Grand.Web\App_Data\DataProtectionKeys you can find keys. Copy this directory from one server to other machines.
They should be the same on all servers.

Regards
Krzysztof
0
  • Posted: Wednesday, June 30, 2021 12:16 PM
  • 7
Hello there

I defined the key to all servers, but when I restart any of the servers, it causes a problem. Your new version also mentions this setting "RedisCachingEnabled". I think this is the solution for me. But how can I get this improvement for 4.70.
0
back to top
Filters