By default, if fire-and-forgot job failed, Hangfire will re-try it, but sometime we don’t want the job re-try, if failed, no more action.
So in this scenario we need to set re-try to zero in method attribute:
[AutomaticRetry(Attempts = 0)]
public void DoSomething()
{
......
}
if we want to disable globally, we can config it in application startup, modify Configure method in Startup.cs file:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
......
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });
......
}