Use dashboard in Self-Hosted OWIN Console Application

Hi
How can I use dashboard in Self-Hosted OWIN Console Application ?

I started with this

using (WebApp.Start<Startup>("http://localhost:8888"))
        {
            Console.WriteLine("Server started... press ENTER to shut down");
            Console.ReadLine();
        }

and this is my configuration

public void Configuration(IAppBuilder app)
    {

        app.UseWelcomePage();

        var options = new SqlServerStorageOptions
        {
            PrepareSchemaIfNecessary = false,
            QueuePollInterval = TimeSpan.FromSeconds(15) // Default value

        };
        
        
        app.UseHangfire(config =>
        {
            config.UseSqlServerStorage(conn, options);
            config.UseServer();
            
        });


        
        app.UseHangfireDashboard("/hangfire", new DashboardOptions
        {
            AuthorizationFilters = new[]{new CustomAuthorization()},
            AppPath = "http://localhost:8888/hangfire" 
        
        });
    }

any help would be appreciated.

Looks like you are using Hangfire 1.4.0. Then use the following configuration class:

public void Configuration(IAppBuilder app)
{
    app.UseWelcomePage();

    GlobalConfiguration.Configuration
        .UseSqlServerStorage(new SqlServerStorageOptions { PrepareSchemaIfNecessary = false });
        
    app.UseHangfireServer();
    app.UseHangfireDashboard("/hangfire", new DashboardOptions
    {
        AuthorizationFilters = new[]{ new CustomAuthorization() },
    });
}

Hi

this is the sample that I’ve worked, the welcome page will be displayed but it doesn’t show dashboard . can you see where the problem is ?

by the way, I use 1.4.1

What URL are you using? http://localhost:8888/hangfire should work fine.

yes I use http://localhost:8888/hangfire . but it doesn’t work .

Did the sample work for you with above URL?

I couldn’t come up with a solution and the sample didn’t work for me but as a trick, is it possible to use hangfire dashboard in an asp.net mvc app which doesn’t use this line //app.UseHangfireServer(); as below ? to be able to use just hangfire dashboard and not the hangfire servers to handle the tasks

    public void Configuration(IAppBuilder app)
    {

        GlobalConfiguration.Configuration
            .UseSqlServerStorage(conn, new SqlServerStorageOptions {PrepareSchemaIfNecessary = false});

        //app.UseHangfireServer();
        app.UseHangfireDashboard("/hangfire");

    }

and then use the below code , in another app as a windows service or a console app . Actually I want to use mvc just to provide dashboard and console app or windows service just to handle the tasks .

public void Configuration(IAppBuilder app)
    {

        GlobalConfiguration.Configuration
            .UseSqlServerStorage(conn, new SqlServerStorageOptions {PrepareSchemaIfNecessary = false});

        app.UseHangfireServer();
        app.UseHangfireDashboard("/hangfire");

    }

what’s your Idea ?

Didn’t work is too general and ambiguous – blank screen, exception, 404 error, etc, etc. Can you provide more information about this topic. You can also include the following method to see actual exceptions:

app.UseErrorPage();
//app.UseHangfireServer();
app.UseHangfireDashboard("/hangfire");

I’ve checked these both URLs: http://localhost:8888 , http://localhost:8888/hangfire . and for both I just see the welcome page . And also I used app.UseErrorPage();, but nothing happened , Neither error nor exception

and if I comment //app.UseWelcomePage(); the error would be “This webpage is not available” for both URLs

Can you create a GitHub repository for that or share full source code of your application via Google Drive, Dropbox, etc?

Here it is the repository on GitHub.

Thank you for your patience and cooperation.

Could you upload the project again to serve as an example. This thread seems important for anyone who is starting off for the first time.