I don’t wish to impersonate for the entire application’s life.
For example on startup to undo the impersonation:
using (System.Security.Principal.WindowsImpersonationContext ctx = someWindowsIdentity.Impersonate())
{
GlobalConfiguration.Configuration.UseSqlServerStorage(“x”);
ctx.Undo();
}
Is there a way I can get Hangfire to go through this code everytime it establishes a connection to its SsqlServerStorage? How does Hangfire establish and mantain its connections? Is there somewhere I can override this?