Hi,
We are using V.12.1 Core.Mvc. Our problem is ValidateUserDelegation Method. This situation at Azure PaaS DB. But We tried at Local DB. It's working. Atboth of them start and end date configurations true. But not working at live. Select button came at user menu.
I'am sharing logs at you.
ERROR 2023-05-09 15:06:54,654 [18 ] spNetCore.Antiforgery.DefaultAntiforgery - An exception was thrown while deserializing the token.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
---> System.Security.Cryptography.CryptographicException: The key {b3a8d62f-7ed6-4648-9e30-b38f5d8f42fd} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
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)
WARN 2023-05-09 15:06:57,074 [18 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
WARN 2023-05-09 15:06:57,175 [18 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
WARN 2023-05-09 15:06:57,235 [18 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
WARN 2023-05-09 15:07:24,042 [8 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
WARN 2023-05-09 15:07:24,318 [50 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
ERROR 2023-05-09 15:07:24,436 [50 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request.
Abp.UI.UserFriendlyException: ThereIsNoActiveUserDelegationBetweenYourUserAndCurrentUser
at TDV.Identity.SecurityStampValidator.ValidateUserDelegation(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 81
at TDV.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 49
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync[TValidator](CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidatePrincipalAsync(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationEvents.ValidatePrincipal(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
ERROR 2023-05-09 15:07:24,439 [50 ] e.Diagnostics.ExceptionHandlerMiddleware - An exception was thrown attempting to execute the error handler.
Abp.UI.UserFriendlyException: ThereIsNoActiveUserDelegationBetweenYourUserAndCurrentUser
at TDV.Identity.SecurityStampValidator.ValidateUserDelegation(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 81
at TDV.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 49
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync[TValidator](CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidatePrincipalAsync(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationEvents.ValidatePrincipal(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
ERROR 2023-05-09 15:07:24,442 [50 ] AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "14843864373423789529", Request ID "8000563e-0000-ce00-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Abp.UI.UserFriendlyException: ThereIsNoActiveUserDelegationBetweenYourUserAndCurrentUser
at TDV.Identity.SecurityStampValidator.ValidateUserDelegation(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 81
at TDV.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext context) in C:\Workspaces\TDV.FYS\src\TDV.Core\Identity\SecurityStampValidator.cs:line 49
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync[TValidator](CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidatePrincipalAsync(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationEvents.ValidatePrincipal(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)
at Abp.AspNetCore.Mvc.Caching.GetScriptsResponsePerUserCacheMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
WARN 2023-05-09 15:07:46,585 [50 ] EntityFrameworkCore.Database.Transaction - Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
Best regards.
5 Answer(s)
-
0
-
0
Hi @ismcagdas
No problem. I tried your said. sourceUserId and targetUserId existed in db. hasActiveDelegation returned null. But these user IDs exist in DB.
Then I thought this problem was from the start date configuration. For example it didn't work when startDate: 2023-05-12 09:00. My current time is 2023-05-12 9:30. I changed the start date to 2023-05-12 06:00. it worked. I think this issue is due to time configuration. How do I fixed this problem?
-
0
Hi @tdv.yazilim
Did you set
Clock.Provider
in your app or do you use its default ? -
0
We are using default.
-
0
Hi @tdv.yazilim
Thanks, let us check it and inform you. At the moment, you will have problem only with timezones, so user delegations will be hidden for a few hours before or after the expire date.