We have a distributed lock code like this, but it seems, the second thread didn't wait till first thread finished db insert
await using var handle = await _distributedLock.TryAcquireAsync($"api-lock", TimeSpan.FromMinutes(5));
try {
if (handle != null)
{
var rtCertifcate = _apiClient.CallApi (); //external API
if (!string.IsNullOrWhiteSpace(rtCertifcate ))
{
//insert into database for rtCertifcate
return rtCertifcate
}
}
else
{
// If we can't acquire the lock, fall back to database lookup
Logger.LogWarning("....");
}
}
catch
{
}
//Code read certificate from database
ABP 8 MicroService architect, when backend throw an UserFriendlyException, the message not showing in Angular client, instead an Internal error message is shown
ABP framework 9, the customize Login page can remove self registration link, how to disable this feature so that swagger API also has no this API (api/account/register)
Since our EF core Mapping use some syntax not supporting SqlLite, we need to mock each repository / app service when write test code for an AppService. However, while doing this way, AppService's Logger is null and throw exception for all places using it in the AppService. I guess any place using CurrentUser, CurrentTenant, CurrentUnitOfWork would also throw null reference exception
After upgrade the application 4 to ABP 8, the new user doesn't work with Single Sign On with Azure AD. Application: No Multi-tenancy, Layered application
All existing users, the login looks fine. From AbpUserLogin table we can tell the provider is Azure AD. However, when create a new user via admin UI (enter user info and assigned roles), the AbpUsers and AbpUserRoles table data looks good. But when login into the application via single sign-on from Azure AD, the application is navigated to user registration page.
We have such use cases: Micro serivce A publish a event to distributed bus (set userId property in event) , Micro server B handle the event, Micro service B need to call Micro Service C's API to get some data, that API is not anonymous, in this case, Service C would reject the API call because of missing access token.
How to handle such case?
Our UAT environment throw this exception when a batch messages (around 2k) sent to distributed event bus: " MessageTemplate Cannot access a disposed object. Object name: 'RabbitMQ.Client.Impl.AutorecoveringModel'. SourceContext Volo.Abp.RabbitMQ.RabbitMqMessageConsume
System.ObjectDisposedException: at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer+<HandleIncomingMessageAsync>d__46.MoveNext (Volo.Abp.RabbitMQ, Version=8.2.3.0, Culture=neutral, PublicKeyToken=null)
"
I noticed even in ABP 8 application (Micro Service), Abp Audit Log has a lot of exception:
/api/account/my-profile [ { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": {}, "validationErrors": null } ]
We rolled back our QA site from ABP 9 to ABP8:
However, when login page, it keeps giving us 500 error in login page, from exception below, obviously in ABP 9 these columns are dropped, but ABP 8 table has it. We check the code deployed to app container, the ABP version is 8.2.3. We delete the redis cache pod, and create a new one, the error is still there.
[17:21:29 ERR] An unhandled exception has occurred while executing the request.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'IsDeleted'.
Invalid column name 'CreationTime'.
Invalid column name 'CreatorId'.
Invalid column name 'DeleterId'.
Invalid column name 'DeletionTime'.
Invalid column name 'IsDeleted'.
Invalid column name 'LastModificationTime'.
Invalid column name 'LastModifierId'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__195_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable
1 source, CancellationToken cancellationToken)
at Volo.Abp.OpenIddict.Authorizations.EfCoreOpenIddictAuthorizationRepository.FindAsync(String subject, Guid client, String status, String type, CancellationToken cancellationToken)
I noticed ABP has these code:
context.Services .AddDataProtection() .SetApplicationName("MyApp") .PersistKeysToStackExchangeRedis(redis, "MyApp-Protection-Keys");
However, if our application want to use Microsoft Data Protection API to encyrpt/decrypt business data, we have this settings: services.AddDataProtection() .ProtectKeysWithAzureKeyVault(new Uri(keyId), new DefaultAzureCredential(new DefaultAzureCredentialOptions { ManagedIdentityClientId = keyVaultClientId })) .PersistKeysToAzureBlobStorage(azureStorageConnectionString, containerName, EncrptionConsts.DataProtectionKeyBlobName) .SetDefaultKeyLifetime(TimeSpan.FromDays(36500));
Would these two settings conflict with each other, can we simply comment out ABP's AddDataProtectioncode?
Thanks