Hello, Our project structure is mentioned in this ticket : https://support.abp.io/QA/Questions/4663#answer-3a09d256-58d0-4c55-dc67-7e989f693fb3
We tried to add Hangfire in Admin part of the project (ConfigurateurClient.Admin.HttpApi.Host\AdminHttpApiHostModule.cs).
we called app.UseHangFireDashboard on the last line of OnApplicationInitialization method.
The Admin.HangFire pemrission is well defined in the application.contract layer
But when we want acces to https://localhost:44340/hangfire, we have this message.
Avez-vous des informations sur ce que nous aurions pu manquer pour générer ce type d'erreur ?
ABP Framework version: v7.0.0
UI type: Angular and Blazor (not relevant here)
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
17 Answer(s)
-
0
Any chance to send the content of your
OnApplicationInitializationmethod? Maybe you have a missing or misordered request-response pipeline.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseAbpRequestLocalization(); app.UseStaticFiles(); app.UseAbpSecurityHeaders(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); } app.UseAuthorization(); app.UseSwagger(); app.UseAbpSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Admin API"); var configuration = context.GetConfiguration(); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); }); app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseUnitOfWork(); app.UseConfiguredEndpoints(); app.UseHangfireDashboard("/hangfire", new DashboardOptions { AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(enableTenant: true, requiredPermissionName: "Admin.HangFire") } }); }```Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
First of all,
UseHangfireDashboardmust be beforeUseConfiguredEndpoints. However, this is not the problem, I tried to reproduce the problem with the information you provided, but I was unsuccessful, here is my code:ConfigureServices:
... ... ... ... ConfigureHangfire(context, configuration);ConfigureHangfire:
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddHangfire(config => { config.UseInMemoryStorage(); }); }OnApplicationInitialization:
public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseAbpRequestLocalization(); app.UseStaticFiles(); app.UseAbpSecurityHeaders(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); if (MultiTenancyConsts.IsEnabled) { app.UseMultiTenancy(); } app.UseAuthorization(); app.UseSwagger(); app.UseAbpSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Admin API"); var configuration = context.GetConfiguration(); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); }); app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseUnitOfWork(); app.UseHangfireDashboard("/hangfire", new DashboardOptions { AsyncAuthorization = new[] {new AbpHangfireAuthorizationFilter(enableTenant: true, requiredPermissionName: "Admin.HangFire")} }); app.UseConfiguredEndpoints(); }When we look at the status code, it returns 401. So, it doesn't see you as authorized, but I think you are logged in. It felt like
CurrentUser.IsAuthenticatedwas returning false somehow. Can you confirm this information by debuggingAbpHangfireAuthorizationFilterMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
Yes, because the
CurrentUserservice is resolved fromRequestServicesinIsLoggedInmethod.See: https://github.com/abpframework/abp/blob/ba6ded35524cd4f743f263f33ac37cbc8f238fcd/framework/src/Volo.Abp.HangFire/Volo/Abp/Hangfire/AbpHangfireAuthorizationFilter.cs#L38-L45
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
I understand, but you're logged in, right? You can see your account information, or if you are logged in as an admin user, you can visit the page where you can see the list of all users and so on, right? If so, I might need to take a closer look at your project. It's hard to say anything directly.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I logged in using the swagger's built-in function here

And when checking the Authentication server's page, it does show me as logged in.
We can grant you access to the Github repository. Can you confirm this is you ? https://github.com/berkansasmaz Hangfire is being implemented on branch 346-use-hangfire
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I am very happy with the information you have given because I understand the problem. But we need to verify, so can you visit the
/account/loginpage and try again after login?Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Got it, you can grant access to this GitHub account.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
The problem is that you have installed
HangfireinConfigurateurClient.Admin.HttpApi.Host. If you want to useHangfirein this project, you should editConfigureAuthenticationsimilar toConfigurateurClient.Admin.Blazor, but I don't recommend it. You don't need to openConfigurateurClient.Admin.HttpApi.Hostoutside, it can stay internal. Users withConfigurateurClient.Admin.Blazoradmin privileges can access as the UI allows, but they don't need to accessConfigurateurClient.Admin.HttpApi.Hostso you don't need to open its URL outside.As a result, if you want to solve the problem with the least effort and with a more accurate method, you can solve the problem by moving similar codes to
ConfigurateurClient.Admin.Blazor. I tried it works, you can see the screenshot below.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Closing the issue. Feel free to re-open or create a new issue if you have further questions 😄
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)







