Hi, I have a problem with simultaneous requests from the same user with at least one record on AbpUserTokens expired. The client is an Angular 6 spa. When user press F5 to refresh the page (not in the login process), and multiple request are made to the host that is in not alread loaded in memory by IIS, IsTokenValidityKeyValidAsync is called many time and only the firt succeed while the others raise a concurreny error.
Every calls on uow commit try to delete the same expired records. It seems that the method ValidateToken on FrameworkJwtSecurityTokenHandler isn't multi thread safe.
We have recorded a video and produced some immages to better understand the issue. As you will see, 4 calls are made, but only the firt succeed because the others three try to delete the same record on database.
Image 001 show the table before page refresh, image 002 show the table after refresh and image 003 show the profiler with 4 same calls to delete that cause the error
So, how can we deal with this issue? Thank you.
Abp.Domain.Uow.AbpDbConcurrencyException HResult=0x80131500 Message=Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions. Source=Abp.EntityFrameworkCore StackTrace: at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges() at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.SaveChanges() at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesInDbContext(DbContext dbContext) at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChanges() at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUow() at Abp.Domain.Uow.UnitOfWorkBase.Complete() at Uno.Framework.Web.Authentication.JwtBearer.FrameworkJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) in C:\Uno\Git\uno-ins\framework\src\Uno.Framework.Web.Core\Authentication\JwtBearer\FrameworkJwtSecurityTokenHandler.cs:line 63 at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.
Inner Exception 1: DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
Link to video: https://drive.google.com/open?id=1pdS7z4Wy74cr066bbQLwLwCXW45nU2RO
Abp 3.8.2 Asp.Net ~~Boilerplate~~ Zero 5.6.0
Hi, I'm implementing a new interceptor on Core version of Abp to make a different kind of log. Initially it didn't work but I've read that for Core the method must be virtual. But I've also read in this post [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=11098&p=28564&hilit=interceptors#p28564]) that you don't use interceptor. So, to stay in sync, how do you log every application service methods on Core ?
Thank you
Hi, I've been trying since this afternoon to configure Entity History but changes are not tracked. What I'm missing? This is what I've done on my module (loaded as plugin)
On PreInitialize
Configuration.EntityHistory.IsEnabled = true;
Configuration.EntityHistory.Selectors.Add("MyEntities", typeof(DocumentTemplateData));
DocumentTemplateData
[Audited]
public class DocumentoTemplateData : FullAuditedEntity, IPassivable
{
public string Name { get; set; }
public string Description { get; set; }
public string Html { get; set; }
....
On ApplicationService on Web side:
[HttpPut("UpdateDocument")]
[UseCase(Description = "Update document")]
public async Task UpdateDocument(UpdateDocumentDto input)
{
await _reportEngineApplicationService.UpdateDocument(input);
}
On ReportEngineApplicationService in interal side:
[DisableAuditing] // <- Do not show these methods on logs
public class ReportEngineApplicationService : ApplicationService, IReportEngineApplicationService
{
private readonly IReportEngine _reportEngine;
private readonly IDocumentTemplateRepository _documentTemplateRepository;
...
public async Task UpdateDocument(UpdateDocumentDto input)
{
var document = await _documentTemplateRepository.GetAsync(input.Id);
// some business stuff
await _documentTemplateRepository.UpdateAsync(document);
Repository
public async Task UpdateAsync(DocumentTemplate aggregate)
{
var data = aggregate.Snapshot;
data.Name = aggregate.Name;
data.Description = aggregate.Description;
data.Html = aggregate.Html;
data.IsActive = aggregate.IsActive;
await _documentTemplateRepository.UpdateAsync(data);
Thank you
Hi, I've two plugin modules.
The first one is composed by two dll. One shared with the interface, and one other with the concrete implementation.
REngine -> REngineModule -> REngine : IEngine RShared -> RSharedModule -> IEngine
The second module need to register some stuffs to REngine on PostInitialize. I've used the DependsOn attribute but PModule is loaded earlier then RSharedModule and I've the exception: PModule is waiting for the following dependencies: IEngine
[DependsOn(typeof(RSharedModule))]
public class PModule : AbpModule
{
private readonly IEngine _engine;
public PModule(IEngine engine)
{
_engine = engine;
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(PModule).GetAssembly());
}
public override void PostInitialize()
{
_engine.Register(new PicSource);
}
}
If I use IocManager.Resolve<IEngine>() all works.
So, the question is: How can I tell to abp to instantiate one module before others?
Thank you.
Hi, after test the Core + Angular 5.5.2 version on dev machine with success, I've published on test windows server. Installed the Aspnet + Host bundle 2.1.2 I receive this error: It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '2.1.0-preview1-26216-03' was not found.
If I simply copy the 2.1.2 folder e rename to 2.1.0-preview1-26216-03 the site works. Do you know this issue ?
Thank you
Hi, I'm trying to use Aspose.Words library on a plugin module but there is a problem to load referenced library. In a classic .Net Core 2.0 web project all works fine as you can see on the attached project.
Aspose.Words and SkiaSharp.dll are in plugin folder, and all runtimes in runtimes folder in root.
When used in a plugin module I have this error:
ERROR 2018-07-11 14:14:33,990 [9 ] Mvc.ExceptionHandling.AbpExceptionFilter - The type initializer for 'SkiaSharp.SKAbstractManagedStream' threw an exception.
System.TypeInitializationException: The type initializer for 'SkiaSharp.SKAbstractManagedStream' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': Impossibile trovare il modulo specificato. (Exception from HRESULT: 0x8007007E)
So I think that I have to do something else to use Aspose.Words in AspNetBoilerplate Core 2.0. Can you help me? NetCoreWebApp.zip
Hi, how can I configure log4net in Abp Core 5.3.0 to reload configuration when log4net.config change?
I've tried the old way but doesn't works.
<appSettings>
<add key="log4net.Config" value="log4net.config"/>
<add key="log4net.Config.Watch" value="True"/>
</appSettings>
It is possible?
Thanks
Hi, My module has his own xml localization. I need to extend some default message of Abp, but on startup I receive this error:
FATAL 2018-05-11 17:20:40,450 [1 ] Abp.AbpBootstrapper - Abp.AbpInitializationException: Security source contains more than one dictionary for the culture: en
at Abp.Localization.Dictionaries.Xml.XmlEmbeddedFileLocalizationDictionaryProvider.Initialize(String sourceName)
at Abp.Localization.LocalizationManager.InitializeSources()
at Abp.AbpKernelModule.PostInitialize()
at System.Collections.Generic.List1.ForEach(Action
1 action)
at Abp.AbpBootstrapper.Initialize()
This is my code
public static class SecurityLocalizationConfigurer
{
public static void Configure(ILocalizationConfiguration localizationConfiguration)
{
localizationConfiguration.Sources.Add(
new DictionaryBasedLocalizationSource(
DomainConsts.LocalizationSourceName,
new XmlEmbeddedFileLocalizationDictionaryProvider(
Assembly.GetExecutingAssembly(),
"Uno.Security.Core.Localization"
)
)
);
localizationConfiguration.Sources.Extensions.Add(
new LocalizationSourceExtensionInfo(FrameworkConsts.LocalizationSourceName,
new XmlEmbeddedFileLocalizationDictionaryProvider(
Assembly.GetExecutingAssembly(),
"Uno.Security.Core.LocalizationExtensions"
)
)
);
}
}
and the folder structure is: root ---Localization ------Security.xml ---LocalizationExtensions ------Framework.xml
Note that localization works fine for my security.xml. When I add the extensions, the application hangs. How Can I override default message and also manage my own localization on same project?
Thanks Ivano
Hi, even if you set AbpZeroSettingNames.UserManagement.UserLockOut.IsEnabled to false in Host or Tenant settings, when a new user is created, the property IsLockoutEnabled is always true.
Subsequently, if you update the user, IsLockoutEnabled is set to true or false, based on the UI check box.
Version 5.3.0, Core & Angular.
Is by design or an Asp.Net Identity problem?
Thanks, Ivano
Hi,
We are trying to extend the Tenant separation logic adding Organization units (with Single Deployment - Single Database scenario).
The main idea is that the data's owner can be Host, Tenant or Organization Unit. Host, Tenant and Organization Unit have a hierarchical relationship.
Host has data that can be viewed by every Tenants. Tentant has data that can be viewed by his Organization Units. OrganizationUnit has data that can be viewed only by itself.
Every user belongs to one Host, one Tenant and many Organization Units (but only one at the same time). So, a logged user, has always a Host, a TenantId and a OrganizatinUnitId.
When data are retrived from repository they should be automatic filtered by current Host, current TenantId and current OrganizationUnitId. But there shuold be also a standard way to get entities including parents or children so that every developer does not have to rewrite the search logics In that manner normal user can show in a readonly mode Host's data, Tenant's data and , in write mode, own data. Same logic per Tenant users and Host users.
I guess that a new IMayHaveOrganizationUnit can help but the main point is that all has to be provided by the framework itself.
Do you have some suggestions about ?
Thank you