.net core Hangfire.Net核心404

.net core Hangfire.Net核心404,.net-core,hangfire,.net Core,Hangfire,我们正在尝试将hangfire与部署到linux box的.Net内核一起使用。我们可以在本地运行和查看Hangfire仪表板,以及其他页面,如Retries、jobs等。但是当我们部署代码时,我们看到仪表板,但是所有css和js以及链接都指向domain/Hangfire/而不是domain/appname/Hangfire public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvi

我们正在尝试将hangfire与部署到linux box的.Net内核一起使用。我们可以在本地运行和查看Hangfire仪表板,以及其他页面,如Retries、jobs等。但是当我们部署代码时,我们看到仪表板,但是所有css和js以及链接都指向domain/Hangfire/而不是domain/appname/Hangfire

public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)
{
    IConfigurationService confiuration = (IConfigurationService)serviceProvider.GetService(typeof(IConfigurationService));
    app.Use((context, next) =>
    {
        var pathBase = context.Request.Headers["X-Forwarded-PathBase"];
        context.Request.PathBase = new PathString(pathBase);
        return next();
    });

    app.UseCors(builder =>
    builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials());

    if (!env.IsProduction())
    {
        app.UseDeveloperExceptionPage();
    }
    app.UseSwagger(c =>
    {
        c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.BasePath = Configuration["Swagger:BasePath"]);
    });

    app.UseSwaggerUI(c =>
    {
        c.SwaggerEndpoint(Configuration["Swagger:JSONLocation"], "My Scheduler API V1");
        c.DocExpansion(DocExpansion.None);
    });
    app.UseAuthentication();
    //app.UseMiddleware<BasicAuthMiddleware>(confiuration.ApplicationUri);
    app.UseBasicAuthentication(confiuration.ApplicationUri);

    var options = new DashboardOptions
    {
        Authorization = new[] { new HangfireAuthorizationFilter() }
    };
    app.UseHangfireDashboard("/hangfire", options);
    app.UseHangfireServer();

    SchedulerInitializer.InitializeScheduler(confiuration);

    app.UseMvc();
}
public void配置(IApplicationBuilder应用程序、IHostingEnvironment环境、IServiceProvider服务提供商)
{
IConfigurationService confirfication=(IConfigurationService)serviceProvider.GetService(typeof(IConfigurationService));
应用程序使用((上下文,下一步)=>
{
var pathBase=context.Request.Headers[“X-Forwarded-pathBase”];
context.Request.PathBase=新路径字符串(PathBase);
返回next();
});
app.UseCors(builder=>
builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials());
如果(!env.IsProduction())
{
app.UseDeveloperExceptionPage();
}
app.UseSwagger(c=>
{
c、 添加((swaggerDoc,httpReq)=>swaggerDoc.BasePath=Configuration[“Swagger:BasePath”]);
});
app.UseSwaggerUI(c=>
{
c、 Swagger端点(配置[“Swagger:JSONLocation”],“我的调度程序API V1”);
c、 DocExpansion(DocExpansion.None);
});
app.UseAuthentication();
//应用程序使用中间件(confirfication.ApplicationUri);
应用基本认证(确认应用RI);
var options=新的仪表板选项
{
Authorization=new[]{new HangfireAuthorizationFilter()}
};
app.UseHangfireDashboard(“/hangfire”,选项);
app.UseHangfireServer();
SchedulerInitializer.初始化Scheduler(确认);
app.UseMvc();
}

调用UseHangfireDashboard时是否尝试更改
appname/hangfire
?我猜它会按照文档工作,我也面临同样的错误。我确实尝试了appname/hangfire,但仍然没有成功。我还收到了404.0错误。在我安装swagger、Swashback和nswag之前,Hangfire运行良好。