Where can I find some documentation regarding which options are available on the hosting.json
file? Right now I\'m using the server.ulrs
but I\'m wonde
I'm wondering if can I add the https certificate path/password on it.
Out of the box, you cannot use hosting.json to set up your HTTPs certificate and credentials. You can, though, write custom code to support that scenario. There is a GitHub issue about that with a sample project by the Tratcher.
Where can I find ... documentation regarding ... options ... available in the hosting.json file?
The hosting.json file usually passes its options to the WebHostBuilder.UseConfiguration
method.
This is that static class:
public static class WebHostDefaults
{
public static readonly string ApplicationKey = "applicationName";
public static readonly string StartupAssemblyKey = "startupAssembly";
public static readonly string DetailedErrorsKey = "detailedErrors";
public static readonly string EnvironmentKey = "environment";
public static readonly string WebRootKey = "webroot";
public static readonly string CaptureStartupErrorsKey = "captureStartupErrors";
public static readonly string ServerUrlsKey = "urls";
public static readonly string ContentRootKey = "contentRoot";
}
For instance, the following hosting.json file...
{
"urls": "http://localhost:12345;http://localhost:54321",
"contentRoot": "C:\\foobar",
"environment": "QualityAssurance"
}
...and the following entry point...
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddJsonFile("hosting.json", optional: false)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup()
.Build();
host.Run();
}
}
...leads to the following output...
PS C:\temp> dotnet run
Hosting environment: QualityAssurance
Content root path: C:\foobar
Now listening on: http://localhost:12345
Now listening on: http://localhost:54321
Application started. Press Ctrl+C to shut down.
urls
instead of server.urls
. The latter is listed as the DeprecatedServerUrlsKey
in the GitHub.com/aspnet/hosting repository.