Hi,
Below codes runs under Hangfire task scheduler. it runs without an exception while someone is using the site, but if no one uses the site for a while, it throws an exception "Cannot access a disposed object. Object name: 'UserManagerProxy"
var isRankingPermissionGranted = await _permissionChecker.IsGrantedAsync(AppPermissions.Pages_Vehicles_Reporting_FinanceAndInsurance_Ranking);
I tried below code too but it does't work either.
using (_abpSession.Use(ui.TenantId, ui.UserId))
{
var isRankingPermissionGranted =
await _permissionChecker.IsGrantedAsync(AppPermissions.Pages_Vehicles_Reporting_FinanceAndInsurance_Ranking);
}
9 Answer(s)
-
0
How is PermissionChecker being resolved?
-
0
It's resolved by constructor injection. The class looks like below, I removed others for readability.
public class FinanceAndInsuranceJob : BackgroundJob<FinanceAndInsuranceJobArgs>, ITransientDependency { private readonly IPermissionChecker _permissionChecker; private readonly IAbpSession _abpSession; public FinanceAndInsuranceJob( IPermissionChecker permissionChecker, IAbpSession abpSession) { _permissionChecker = permissionChecker; _abpSession = abpSession; } }
I created two separate jobs by 2 different user account. then I logged out 1 account. after 20~30 minutes, the job created by currently logged in user works. but the other does not.
Asp.Net Zero 4.0 [Angular4, Core 2.0 version]
-
0
Can you show the full stack trace in Logs.txt?
-
0
This is from logs.txt file.
INFO 2017-12-04 15:53:25,865 [1 ] Hangfire.SqlServer.SqlServerStorage - Start installing Hangfire SQL objects... INFO 2017-12-04 15:53:25,938 [1 ] Hangfire.SqlServer.SqlServerStorage - Hangfire SQL objects installed. INFO 2017-12-04 15:53:25,960 [1 ] Hangfire.BackgroundJobServer - Starting Hangfire Server INFO 2017-12-04 15:53:25,962 [1 ] Hangfire.BackgroundJobServer - Using job storage: 'SQL Server: HGTOSQL01.HGC.COM@deepblue-spa' INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Using the following options for SQL Server job storage: INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Queue poll interval: 00:00:15. INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Using the following options for Hangfire Server: INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Worker count: 20 INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Listening queues: 'default' INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Shutdown timeout: 00:00:15 INFO 2017-12-04 15:53:25,963 [1 ] Hangfire.BackgroundJobServer - Schedule polling interval: 00:00:15 INFO 2017-12-04 15:53:26,398 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/AbpUserConfiguration/GetAll">http://deepbluespa.hgc.com/AbpUserConfiguration/GetAll</a>
INFO 2017-12-04 15:53:26,429 [11 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:26,463 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 71.7548ms 204 INFO 2017-12-04 15:53:26,482 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/AbpUserConfiguration/GetAll">http://deepbluespa.hgc.com/AbpUserConfiguration/GetAll</a> application/json INFO 2017-12-04 15:53:26,483 [14 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:26,589 [14 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:26,592 [14 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:26,897 [10 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:26,945 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:27,461 [17 ] matters.Json.Internal.JsonResultExecutor - Executing JsonResult, writing value Abp.Web.Models.AjaxResponse. INFO 2017-12-04 15:53:27,524 [17 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 634.6869ms INFO 2017-12-04 15:53:27,526 [17 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1043.9417ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:27,630 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Session/GetCurrentLoginInformations">http://deepbluespa.hgc.com/api/services ... formations</a>
INFO 2017-12-04 15:53:27,630 [14 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:27,630 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1858ms 204 INFO 2017-12-04 15:53:27,705 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Session/GetCurrentLoginInformations">http://deepbluespa.hgc.com/api/services ... formations</a> application/json INFO 2017-12-04 15:53:27,705 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:27,705 [4 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:27,705 [4 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:27,716 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,097 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Sessions.SessionAppService.GetCurrentLoginInformations (Deepblue.Application) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:28,271 [16 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:28,293 [16 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Sessions.SessionAppService.GetCurrentLoginInformations (Deepblue.Application) in 577.1922ms INFO 2017-12-04 15:53:28,293 [16 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 588.1954ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:28,691 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Session/GetCurrentLoginInformations">http://deepbluespa.hgc.com/api/services ... formations</a> application/json INFO 2017-12-04 15:53:28,691 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,691 [3 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:28,691 [3 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:28,695 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,699 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Sessions.SessionAppService.GetCurrentLoginInformations (Deepblue.Application) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:28,700 [13 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Profile/GetProfilePicture">http://deepbluespa.hgc.com/api/services ... ilePicture</a>
INFO 2017-12-04 15:53:28,700 [13 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,700 [13 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1376ms 204 INFO 2017-12-04 15:53:28,704 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/UserLink/GetRecentlyUsedLinkedUsers">http://deepbluespa.hgc.com/api/services ... inkedUsers</a>
INFO 2017-12-04 15:53:28,704 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,704 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1469ms 204 INFO 2017-12-04 15:53:28,706 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Permission/GetAllPermissions">http://deepbluespa.hgc.com/api/services ... ermissions</a>
INFO 2017-12-04 15:53:28,706 [14 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,706 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1156ms 204 INFO 2017-12-04 15:53:28,706 [11 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:28,707 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Sessions.SessionAppService.GetCurrentLoginInformations (Deepblue.Application) in 11.7136ms INFO 2017-12-04 15:53:28,707 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 15.856ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:28,716 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/User/GetUsers?Filter=&Permission=&MaxResultCount=10&SkipCount=0">http://deepbluespa.hgc.com/api/services ... kipCount=0</a>
INFO 2017-12-04 15:53:28,717 [9 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,717 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1204ms 204 INFO 2017-12-04 15:53:28,721 [17 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Role/GetRoles">http://deepbluespa.hgc.com/api/services ... e/GetRoles</a>
INFO 2017-12-04 15:53:28,721 [17 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,721 [17 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1174ms 204 INFO 2017-12-04 15:53:28,905 [13 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Notification/GetUserNotifications?MaxResultCount=3">http://deepbluespa.hgc.com/api/services ... ultCount=3</a>
INFO 2017-12-04 15:53:28,905 [13 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,905 [13 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1273ms 204 INFO 2017-12-04 15:53:28,919 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/UserLink/GetLinkedUsers?MaxResultCount=10&SkipCount=0">http://deepbluespa.hgc.com/api/services ... kipCount=0</a>
INFO 2017-12-04 15:53:28,920 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:28,920 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.1243ms 204 INFO 2017-12-04 15:53:29,038 [10 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Profile/GetProfilePicture">http://deepbluespa.hgc.com/api/services ... ilePicture</a> application/json INFO 2017-12-04 15:53:29,038 [10 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,039 [10 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,039 [10 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,040 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/UserLink/GetRecentlyUsedLinkedUsers">http://deepbluespa.hgc.com/api/services ... inkedUsers</a> application/json INFO 2017-12-04 15:53:29,040 [11 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,040 [11 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,040 [11 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,041 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Permission/GetAllPermissions">http://deepbluespa.hgc.com/api/services ... ermissions</a> application/json INFO 2017-12-04 15:53:29,041 [9 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,042 [9 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,042 [9 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,044 [10 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,045 [11 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,046 [9 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,058 [17 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/User/GetUsers?Filter=&Permission=&MaxResultCount=10&SkipCount=0">http://deepbluespa.hgc.com/api/services ... kipCount=0</a> application/json INFO 2017-12-04 15:53:29,058 [17 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,058 [17 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,058 [17 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,059 [13 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Role/GetRoles">http://deepbluespa.hgc.com/api/services ... e/GetRoles</a> application/json INFO 2017-12-04 15:53:29,059 [13 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,059 [13 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,059 [13 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,063 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Permissions.PermissionAppService.GetAllPermissions (Deepblue.Application) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:29,067 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/Notification/GetUserNotifications?MaxResultCount=3">http://deepbluespa.hgc.com/api/services ... ultCount=3</a> application/json INFO 2017-12-04 15:53:29,067 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,068 [4 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,068 [4 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,087 [16 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,093 [16 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Permissions.PermissionAppService.GetAllPermissions (Deepblue.Application) in 47.2255ms INFO 2017-12-04 15:53:29,093 [16 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 51.9139ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,109 [13 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,109 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,111 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://deepbluespa.hgc.com/api/services/app/UserLink/GetLinkedUsers?MaxResultCount=10&SkipCount=0">http://deepbluespa.hgc.com/api/services ... kipCount=0</a> application/json INFO 2017-12-04 15:53:29,111 [14 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,111 [14 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2017-12-04 15:53:29,111 [14 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2017-12-04 15:53:29,112 [17 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,117 [14 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2017-12-04 15:53:29,129 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Users.Profile.ProfileAppService.GetProfilePicture (Deepblue.Application) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:29,142 [12 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,143 [12 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Users.Profile.ProfileAppService.GetProfilePicture (Deepblue.Application) in 98.4115ms INFO 2017-12-04 15:53:29,143 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 104.4723ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,202 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Notifications.NotificationAppService.GetUserNotifications (Deepblue.Application) with arguments (Deepblue.Notifications.Dto.GetUserNotificationsInput) - ModelState is Valid INFO 2017-12-04 15:53:29,203 [13 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Roles.RoleAppService.GetRoles (Deepblue.Application) with arguments (Deepblue.Authorization.Roles.Dto.GetRolesInput) - ModelState is Valid INFO 2017-12-04 15:53:29,205 [17 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Users.UserAppService.GetUsers (Deepblue.Application) with arguments (Deepblue.Authorization.Users.Dto.GetUsersInput) - ModelState is Valid INFO 2017-12-04 15:53:29,230 [10 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,234 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Roles.RoleAppService.GetRoles (Deepblue.Application) in 125.3548ms INFO 2017-12-04 15:53:29,234 [10 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 175.2418ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,275 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Users.UserLinkAppService.GetRecentlyUsedLinkedUsers (Deepblue.Application) with arguments ((null)) - ModelState is Valid INFO 2017-12-04 15:53:29,278 [14 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Deepblue.Authorization.Users.UserLinkAppService.GetLinkedUsers (Deepblue.Application) with arguments (Deepblue.Authorization.Users.Dto.GetLinkedUsersInput) - ModelState is Valid INFO 2017-12-04 15:53:29,351 [3 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,354 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Users.UserLinkAppService.GetRecentlyUsedLinkedUsers (Deepblue.Application) in 308.2179ms INFO 2017-12-04 15:53:29,354 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 314.4782ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,354 [10 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,355 [11 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,357 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Users.UserLinkAppService.GetLinkedUsers (Deepblue.Application) in 239.7419ms INFO 2017-12-04 15:53:29,357 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 245.7474ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,366 [10 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Notifications.NotificationAppService.GetUserNotifications (Deepblue.Application) in 256.9711ms INFO 2017-12-04 15:53:29,366 [10 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 299.2175ms 200 application/json; charset=utf-8 INFO 2017-12-04 15:53:29,376 [9 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-12-04 15:53:29,383 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Deepblue.Authorization.Users.UserAppService.GetUsers (Deepblue.Application) in 271.3589ms INFO 2017-12-04 15:53:29,383 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 325.4356ms 200 application/json; charset=utf-8 ERROR 2017-12-04 15:54:02,441 [17 ] eAndInsurance.Dto.FinanceAndInsuranceJob - Cannot access a disposed object. Object name: 'UserManagerProxy'. -
0
That doesn't look like the full stack trace.
-
0
This is the full stack trace.
ERROR 2017-12-05 12:40:47,163 [57 ] eAndInsurance.Dto.FinanceAndInsuranceJob - at Microsoft.AspNetCore.Identity.UserManager
1.ThrowIfDisposed() at Microsoft.AspNetCore.Identity.UserManager
1.FindByIdAsync(String userId) at Castle.Proxies.Invocations.UserManager1_FindByIdAsync.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.UserManagerProxy.FindByIdAsync(String userId) at Abp.Authorization.Users.AbpUserManager
2.<>c__DisplayClass59_0.<<GetUserPermissionCacheItemAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_02.<<GetAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheBase.<GetAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<GetAsync>d__5
2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.<GetUserPermissionCacheItemAsync>d__59.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager
2.<IsGrantedAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.<IsGrantedAsync>d__29.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.PermissionChecker
2.<IsGrantedAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.PermissionChecker`2.I guess somehow userManager is disposed, before the task is completed.
//from boilerplate : aspnetboilerplate/src/Abp.ZeroCore/Authorization/PermissionChecker.cs public PermissionChecker(AbpUserManager<TRole, TUser> userManager) { _userManager = userManager; Logger = NullLogger.Instance; AbpSession = NullAbpSession.Instance; }
I changed the code to directly inject AbpUserManager<Role, User> userManager like below.
//var isRankingPermissionGranted = //_permissionChecker.IsGranted(AppPermissions.Pages_Vehicles_Reporting_FinanceAndInsurance_Ranking); var isRankingPermissionGranted = await _userManager.IsGrantedAsync(ui.UserId, AppPermissions.Pages_Vehicles_Reporting_FinanceAndInsurance_Ranking);
but the same exception occurs.
-
0
I guess the permissions are cached, and above classes(permissionChecker, AspUserManager) uses the cache to validate the permission instead of database??
-
0
How is FinanceAndInsuranceJob.<RunExecuteAsync> called?
-
0
I fixed this issue by not using
IPermissionChecker _permissionChecker;
I instead directly used UserPermissionSetting to get the permission from Database.
IRepository<UserPermissionSetting, long> _userPermissionRepository