Is there a way to compile / build our application once, but be able to deploy to either IIS (using the in-process hosting model) or run standalone using Kestrel?
This is an application that may be in some cases cloud hosted (Azure) but also packaged and installed standalone essentially a desktop-based application service web pages in an intranet scenario.
Currently the certificate file and password are loaded in the IWebHostBuilder implementation:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddSingleton<ConfigurationContainer>(ConfigurationContainer);
})
.UseKestrel(options =>
{
options.ConfigureEndpointDefaults(listenOptions =>
{
if (_useHttps)
listenOptions.UseHttps(_certificateFile, _certificatePword);
});
})
.UseUrls("xxxxx")
.UseStartup<Startup>();
The objective is as above - to be able to essentially host the same build in IIS using (in-process hosting) or run up standalone using Kestrel.