I'm fumbling through my first exploration into docker containers with .NET. My local development environment is good to go - I've got my dev certs created and specified in my configuration file.
However, I'm trying to deploy to Azure Container Instances using a Caddy sidecar as a reverse-proxy. My application container fails on startup with the error: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
As far as I understand, I'll still need Kestrel, however the incoming traffic is no longer required to be HTTPS since it's being routed internally through the reverse-proxy.
I've tried tampering with my Startup.cs
and Program.cs
files to no avail. Can anyone point me in the right direction? Thanks.
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddMvc(options => { options.EnableEndpointRouting = false; });
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app
.UseStaticFiles()
.UseHsts()
.UseHttpsRedirection()
.UseMvc(routes => routes.MapRoute(name: "default", template: "{controller=App}/{action=Index}/{id?}"));
}
Program.cs
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseKestrel();
})
.ConfigureAppConfiguration(cb => { cb.AddEnvironmentVariables(); });