Httpcontext.Current.Request.Islocal does not work in the Startup class

Asked

Viewed 80 times

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);
              
        }
          
     }

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.