Skip to content

Configure multiple hosts at runtime #28228

Answered by davidfowl
MithrilMan asked this question in Q&A
Discussion options

You must be logged in to vote

One host maps to one service provider and while it may be possible to hack that, it's an assumption baked into the host (especially since ConfigureServices is a first class method on the IHostBuilder).

If a single host can implement web api (controllers) on different ports using a single kestrel instance, and thus a single Host, I could adapt my code to that, so please tell me even if this last scenario is possible.

Yes you can listen to multiple ports and have controllers (or any endpoint really) only be valid for a particular host.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@MithrilMan
Comment options

@davidfowl
Comment options

@MithrilMan
Comment options

@davidfowl
Comment options

@MithrilMan
Comment options

Answer selected by davidfowl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants