1
I’m trying to use HttpContext.Current.Request.IsLocal; in an application web api 2 in class Startup method Configuration(IAppBuilder app).
The idea is to just upload a server hangfire if it’s in production, I don’t want to go up local.
The problem is that the server always comes true, and it only happens in this class, I did a test routine on a controller and it worked, returned false.
How could I know if it’s local or not at this point in the system?
Follow the example code:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
bool isLocal = HttpContext.Current.Request.IsLocal;
if (isLocal == false) {
app.UseHangfireServer(boptions);
}
}