saeed mirzaie saran
saeed mirzaie saran

Reputation: 36

How to get current iis website name in ConfigureService() method in startup class in AspCore 2?

I need to get current iis website (started website) name in configureservice method in statup class in aspcore2. I need it in sub class of configureservice I try HttpContextAccessor but it always is null

Upvotes: 1

Views: 990

Answers (1)

Paul Hieltjes
Paul Hieltjes

Reputation: 42

You could use the following code in the startup class:

 public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
        var name = Configuration["ASPNETCORE_APPL_PATH"];
    }

IIS

Code

Upvotes: 0

Related Questions