Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Hangfire Implementation with MVC Asp.net core

$
0
0

Hi,

I have a requirement that implementing the hangfire dashboard inside my application itself.I have a link "Dashboard" in my home page clicking on that Hangfire dashboard should open as the part of my application.

The below code i tried

On click of Dashboard link

public void BuildNavigation(string name, NavigationBuilder builder)
        {
            if (!String.Equals(name, "menu", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            builder
                   .Add(T["Dashboard"], "1", installed => installed.Action("Index", "HangfireDashboard", "Modules.HangfireDashboard"));
        }


Startup.cs

publicclassStartup:StartupBase{publicvoidConfigure(IApplicationBuilder app,IHostingEnvironment env,ILoggerFactory loggerFactory,IServiceProvider serviceProvider){

        app.UseMvc(routes =>{
            routes.MapRoute(name:"default", template:"{controller=HangfireDashboard}/{action=Index}/{id?}");});

        app.UseHangfireServer(options:newBackgroundJobServerOptions(){Activator=newJobActivator()});
        app.UseHangfireDashboard("/TestPage");}publicoverridevoidConfigureServices(IServiceCollection services){
        services.AddHangfire(configuration => configuration.UseSqlServerStorage(TenenatDbConfigurationProvider.GetDefaultConnectionString()));
        services.AddScoped<INavigationProvider,ModulesMenu>();}}

this is opening the index page of the modules not the hangfire dash board.

let me know if anybody have implemented this inside your modules

Thanks

Dev


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>