dotnet / dotnet/aspnetcore

Access IIS SiteName at configuration time (without HttpContext)

Open
#35,772 8 comments 0 reactions 0 assignees View on GitHub
area-networking feature-iis
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is your feature request related to a problem? Please describe.
I need to access the IIS SiteName at configuration time to setup some paths that need to be unique by site (I instantiate the same app several times under different site names in IIS).

The current API (see #17069) only give access to it through server variables, which are only accessible on an HttpContext.

### Describe the solution you'd like
The dotnet fx API provides HostingEnvironment.SiteName which allowed me to access it at application startup. I guess the new API would be under the form of a new Feature in IApplicationBuilder.ServerFeatures but I have no idea how to implement it.

### Additional context
If the request is too niche to be considered, I would appreciate any ideas/pointers on how I could implement it myself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.