This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
Hosting API followup #530
Closed
Description
Continuing discussion on items left over from #525
- Configuration
Currently we use recommend usingbuilder.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
. This is verbose. One suggestion for this is to add aUseConfiguration(string[] args)
overload for only command line configs. Also, there is some contention on whether environment variables and hosting.json configurations should be enabled by default. - WebApplication void Start() vs IDisposable Start()
There are two suggestions forWebApplication.Start()
. We currently use the IDisposable pattern which lends itself to a convenient patternusing(app.Start()){ ... }
where we handle shutdown throughDispose()
. However, since we do not support an application being started more than once, it is natural to returnvoid
. This leads to less desirable usage patterns however, such asusing(var app = builder.Build()){app.Start(); ... }
. - WebApplicationBuilder.Run()/.Start()
Currently we build an application using a builder, configure that application (such as setting addresses), then run or start the application. There is a suggestion on making address configuration more first class on theWebApplicationBuilder
and directly callingStart()
orRun()
on the builder but this will require shuffling of startup since Addresses are currently ServerFeatures that are only available after the WebApplication is built. It's also suggested to possibly add overloads toStart()
andRun()
to take in a list of addresses to listen on. - Exception messages
Some of the current exception messages need to be updated. For example, the message at StartupLoader.cs#L46 can be cryptic. For this exception in particular, it should be determined if it's the responsibility of theWebApplication
or theStartupLoader
, which could be third party, to throw exception to the user.