Hello i have mentioned my problem on a closed thread which i realize afterwards that it is closed :) https://support.aspnetzero.com/QA/Questions/5690 So i was thinking maybe it would be better to create a new one
Here is my problem and stack trace. I believe my problem is related with Cache like on the question that is asked by [email protected]. After couple of days when the users keep their browser with the same session then this problem occurs. It couldn't find the Role for the user from database which is already there. I have tried it by myself after i got the report i try to login as impersonated user. Then i have got the same error. here is the stack trace.
After i restart the iis the problem is solved it is getting the cache again. I use Sql Server 2017 with Asp.Net Zero v5.6.2 with .Net Framework 4.6.1 + Asp.Net Core
ERROR 2018-12-17 10:34:56,118 [136 ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no such an entity. Entity type: ByteBrick.BookAndAd.Authorization.Roles.Role, id: 1
Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: ByteBrick.BookAndAd.Authorization.Roles.Role, id: 1
at Abp.Domain.Repositories.AbpRepositoryBase2.<GetAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Roles.AbpRoleManager2.<>c__DisplayClass50_0.<<GetRolePermissionCacheItemAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_02.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Runtime.Caching.CacheBase.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Runtime.Caching.CacheExtensions.d__52.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Roles.AbpRoleManager2.d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Roles.AbpRoleManager2.<IsGrantedAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.Users.AbpUserManager2.<IsGrantedAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.PermissionChecker2.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Authorization.PermissionChecker`2.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Web.Configuration.AbpUserConfigurationBuilder.d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Web.Configuration.AbpUserConfigurationBuilder.d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfActionResultExecutor.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__24.MoveNext()
Hello, I am having an issue after my latest version upgrade (v5.6.2 angular + asp.net core .netframework full). Application is running without any problem after i log in but after some time probably after the token is expired. I am getting an exception here in this method.
Web.Core --> Authentication --> JwtBearer --> JwtSecurityTokenHandler.cs
public ClaimsPrincipal ValidateToken(string securityToken, TokenValidationParameters validationParameters, out SecurityToken validatedToken)
it is happening when it tries to delete the tokens expired. When try to save new user model to db unitofwork.complete method. It gives me an exception like this.
System.InvalidOperationException: 'The association between entity types 'User' and 'UserToken' has been severed but the relationship is either marked as 'Required' or is implicitly required because the foreign key is not nullable. If the dependent/child entity should be deleted when a required relationship is severed, then setup the relationship to use cascade deletes. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.'
Also you can check this line from github, i think there can be a bug for removing the child entities.
<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/f4a9488b7d3128e7471a9a13acefcae7210aef6b/src/Abp.ZeroCore/Authorization/Users/AbpUserStore.cs#L1306">https://github.com/aspnetboilerplate/as ... e.cs#L1306</a>
Any help would be appreciated. Thank you.
Hello support, We are having a problem with uow in different hangfire workers. These are long operations taking so much time for every job and we are trying to delegate it to the hangfire workers. We created custom command in custom repo deleting old records from db and after it is deleted in the same unitofwork we are trying to insert lots of records to sql db.
When only 1 job is working everything is fine it is doing its job smoothly but when lots of jobs starts at the same time then we are getting timeout exceptions from sql or if we prolong the timeout period it is suspending some sql queries when we analyze it from sql server profiler.
It seems like when one hangfire job is executing the sql queries, on the other hangfire thread it can not run any "delete or insert commands". So it is waiting for the other thread to be finished. I was wondering since every job is in one unit of work doesn't it needs to do "insert and delete commands" on the other hangfire job? It feels like one job is locking the other processes in hangfire.
Let's say i have 4 jobs in hangfire. think that they are doing lots of heavy operations in sql table. inserting 50000 records for each. When one is doing the operation the other job can not do anything cause it doesn't have any access to the table and waiting for the other one to finish? is that the scenario over here? or how should it suppose to work?
Sth like this
public void BookOrders(int offerId, DateTime startDate)
{
var minutes = DateTime.Now.Minute >= 30 ? 30 : 0;
var hours = DateTime.Now.Hour;
var beginDate = startDate.Date + new TimeSpan(hours, minutes, 0);
_bookedOfferItemRepository.Delete(new List<int> { offerId }, beginDate);
var offerItemList = _offerItemRepository.GetAll()
.Include(oi => oi.Offer)
.Include(oi => oi.Dates)
.Include(oi => oi.Times)
.Include(oi => oi.OfferItemScreens).ThenInclude(ois => ois.Screen)
.Where(oi => oi.OfferId == offerId)
.ToList();
if (offerItemList.Any())
{
try
{
_bookedOfferItemRepository.AutoDetectChanges = false;
BookOfferItems(offerItemList, startDate);
}
finally
{
_bookedOfferItemRepository.AutoDetectChanges = true;
}
}
}
inside BookOfferItems method we are doing batch inserts according to some rules and this code starts from hangfire job. which is
[UnitOfWork]
public override void Execute(BookingJobArgs args)
{
var startDate = DateTime.Now;
var stopwatch = new Stopwatch();
try
{
stopwatch.Start();
Logger.Info($"################ STARTED Booking Tenant: {args.TenantId} Offer: ({args.OfferId}) {args.OfferName}");
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant, AbpDataFilters.MustHaveTenant))
{
_bookingManager.BookOrders(args.OfferId, startDate);
}
stopwatch.Stop();
Logger.Info($"################ FINISHED Booking Tenant: {args.TenantId} Offer: ({args.OfferId}) {args.OfferName} Elapsed: {stopwatch.Elapsed.TotalSeconds.ToString()}");
_appNotifier.BookingIsDone(DateTime.Now, args.TenantId, args.OfferName);
}
catch (Exception ex)
{
Logger.Error($"################ ERROR Booking Tenant: {args.TenantId} Offer: ({args.OfferId}) {args.OfferName} Error: {ex.ToString()}");
throw ex;
}
}
and our custom repo method is
public void Delete(List<int> offerIdList, DateTime deleteFromDate)
{
string queryFormat = "DELETE FROM bbBookedOfferItem WHERE {0} and Date >= '{1}'";
if (offerIdList == null || offerIdList.Count < 1)
throw new Exception("BookedOfferItemRepository.Delete(offerIdList) offerIdList can not be null or empty.");
string offerIdClause = string.Format("OfferId = {0}", offerIdList.First());
if (offerIdList.Count > 1)
{
offerIdClause = string.Format("OfferId IN({0})", string.Join(",", offerIdList));
}
string query = string.Format(queryFormat, offerIdClause, deleteFromDate.ToString("yyyy-MM-dd HH:mm:ss"));
Context.Database.ExecuteSqlCommand(query);
Context.SaveChanges();
}
Any help would be appreciated. Thank you.
Hello, I am using the latest asp.net core and angular .net framework v4.6 version. I have a weird problem when i try to use itimezonconverter. I am getting an exception from the application that says.
System.ArgumentException: The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.
Do you know what can cause this problem? It is also doing the same thing in auditlogservice. I have set the clockprovider to utc. and my timezone settings is utc +1 stockholm/berlin
Hello Volosoft, I am using Pomelo EntityFramework Core v 2.0.1 as MySql provider, I have updated my project from AspNetZero v4.0 to v5.0 now everything works fine when i use the MsSql provider. But i have a strange problem when i use the pomelo mysql provider.
I have deleted all the migrations and create a new migration and update the database for mysql. And everything works fine. I can see the tables in mysql db. In my project i am using hangfire so i have done the mysql configuration for hangfire.
When i run the project i can see the swagger page. And from the user interface i can browse login page change the tenant and login to the system with mysql db. But strangely if i log out and try to login again to the application the page stucks when it tries to open the dashboard. The web page is trying to call the service, AbpUserConfiguration/GetAll controller and then it can not get a response like it is in pending state for a long long time. I am attaching the chrome debugger tool snaphot for you to see how it stucks.
Do you have any idea what happens inside that controller probably it can not get the settings data for the user somehow from db that's my guess. Or should i update the project to v5.0.6? How can i fix the issue?
Hello, I was wondering if there is an example how to use primeng datatable with lazy loading inside modal with sorting and paging. If i use the users component example:
getUsers(event?: LazyLoadEvent) {
if (this.primengDatatableHelper.shouldResetPaging(event)) {
this.paginator.changePage(0);
return;
}
this.primengDatatableHelper.showLoadingIndicator();
this._userServiceProxy.getUsers(
this.filterText,
this.permission ? this.selectedPermission : undefined,
this.role,
this.primengDatatableHelper.getSorting(this.dataTable),
this.primengDatatableHelper.getMaxResultCount(this.paginator, event),
this.primengDatatableHelper.getSkipCount(this.paginator, event)
).subscribe(result => {
this.primengDatatableHelper.totalRecordsCount = result.totalCount;
this.primengDatatableHelper.records = result.items;
this.primengDatatableHelper.hideLoadingIndicator();
});
}
this.dataTable will be undefined in modal since it is not displayed and loaded, so how can i fix it to use lazy loading inside the angular modal?
Thank you for the assistance.
Hello, I am trying to migrate my aspnetzero 4.0 angular project to new 5.0 angular project. I was using a npm package as an extra for the version 4.0 but when i try to install the package to new version it is giving me bunch of errors probably it is because of dependencies or sth that i can not find out, here is the package i am trying to install
<a class="postlink" href="https://www.npmjs.com/package/ng2-validation">https://www.npmjs.com/package/ng2-validation</a>
Is there any possibility to install this package to the new version (5.0.4), if it is not possible how can i do the validation except writing a helper component for that? Can you suggest some ideas? maybe there is also a validation in primeng inputs that i am not aware of?
Thanks for your help.
Hello, I am trying to implement a recurring job. It is working fine with background worker class in abp i followed the doc over here <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers">https://aspnetboilerplate.com/Pages/Doc ... nd-Workers</a>
now i wanted to implement this with hangfire. I looked at couple of questions related with this in the forum. #2645
i followed the same steps in this thread but i couldn't manage to make it work. Basically what i have done is uncomment some lines in startup to tell the hangfire to use the sql. Then i have added my recurring job in post initialize method of the web module.
WebHostModule code.
public override void PreInitialize()
{
Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = _appConfiguration["App:ServerRootAddress"] ?? "http://localhost:22742/";
GlobalConfiguration.Configuration.UseActivator(new WindsorHangFireJobActivator());
}
public override void PostInitialize()
{
var offerManager = IocManager.Resolve<IOfferManager>();
RecurringJob.AddOrUpdate("CampaignReminder",() => offerManager.SendRemindersForCampaigns(), Cron.Minutely);
//var workManager = IocManager.Resolve<IBackgroundWorkerManager>();
//workManager.Add(IocManager.Resolve<CampaignReminder>());
}
Startup.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//other codes.
//Hangfire (Enable to use Hangfire instead of default job manager)
services.AddHangfire(config =>
{
config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
//other codes
//Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
//Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
});
app.UseHangfireServer();
}
WebCoreModule
public override void PreInitialize()
{
//other codes
//Uncomment this line to use Hangfire instead of default background job manager (remember also to uncomment related lines in Startup.cs file(s)).
Configuration.BackgroundJobs.UseHangfire();
}
when the application starts i always get an error "JobStorage.Current property value has not been initialized". As i read from the stackoverflow they are always pointing out this code
services.AddHangfire(config =>
{
config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
});
which is fired at startup and in post initialize there is no JobStorage.Current value. What am i missing over here? Any ideas?
Hello, When i run the application in debug mode, I can not see the line numbers when i look at the logs for errors. What should i do to enable them? Any idea? I am using angular & asp.net core v4.0.0 with .net framework 4.6
Hello, My question is related with the model. When i was using ef 6 i was using Microsoft.Linq.Translations package to filter and create calculated properties inside the model. With the help of this library i could create where queries to filter. As an example.
I have Associate, Company and Person model.
Person has FirstName and LastName
Company has only the Name Property and
Associate has Type property which holds the information if it is a person or company
sth like this.
Associate
public class Associate : FullAuditedEntity, IMayHaveTenant
{
public int? TenantId { get; set; }
public AssociateType Type { get; set; }
private static readonly CompiledExpression<Associate, string> NameExpression
= DefaultTranslationOf<Associate>.Property(a => a.Name).Is(a => a.Type == AssociateType.Person ? a.Person.FirstName + " "+ a.Person.LastName : a.Company.Name);
private static readonly CompiledExpression<Associate, string> EmailExpression
= DefaultTranslationOf<Associate>.Property(a => a.Email).Is(a => a.Type == AssociateType.Person ? a.Person.Email : a.Company.Email);
public string Name
{
get
{
return NameExpression.Evaluate(this);
}
}
public string Email
{
get
{
return EmailExpression.Evaluate(this);
}
}
public virtual Person Person { get; set; }
public virtual Company Company { get; set; }
}
As you can see readonly properties are not created in db but i can do the filtering and sorting through iqueryable. I was achieving this with the help of the library but now with the update ef core doesn't support it. Do you have any idea how can i achieve the same behavior with ef core. Thanks in advance.