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 only upload a server hangfire
if it is in production, I do not want to upload local.
The problem is that the server always comes with true
, and this only happens in that class, I did a test routine on a controller
and it worked, it returned false
.
How would I know if it's local or not at this point in the system?
Here is the sample code:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
bool isLocal = HttpContext.Current.Request.IsLocal;
if (isLocal == false) {
app.UseHangfireServer(boptions);
}
}