5

I've published a .NET Core 3 (preview 9) to Azure Web app running on linux. Unfortunately the app won't start and logs show this error:

System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. 2019-09-18T11:45:51.528664649Z To generate a developer certificate run 'dotnet dev-certs https'

I'm accessing the site using the *.azurewebsites.net domain which should have SSL enabled by default. I've published this exact app to Windows Web app without any troubles.

I'm not familiar with Linux very much, but I would like to host it there as its cheaper and seems to offer better performance. Any ideas how can I fix this issue?

Enn
  • 2,137
  • 15
  • 24

3 Answers3

4

This seems to be familiar issue, try the following

dotnet dev-certs https --clean
dotnet dev-certs https -t
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • 1
    hey, I've seen this before, but I don't really know where should I run this. I'm deploying with Azure Dev Ops. – Enn Sep 18 '19 at 11:57
  • 1
    you need to add a dotnet core cli task and add these commands – Sajeetharan Sep 18 '19 at 11:58
  • I tried adding that task (see edit in my post), but it doesn't seem to run. I'm using Ubuntu VM if that makes any difference. – Enn Sep 18 '19 at 12:15
  • so, this doesn't help unfortunately because `dotnet dev-certs https -t` is not supported on Linux :/ – Enn Sep 18 '19 at 12:36
2

Turns out it was a configuration issue. Once I switched to using

WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .UseUrls(YourUrls)
                .UseKestrel()
                .ConfigureKestrel(options =>
                {
                    options.ListenAnyIP(8080);
                })
                .UseIIS()

It started working under Linux just fine.

Enn
  • 2,137
  • 15
  • 24
0

Same problem for me with Ubuntu 18.04. Solved using the following configuration (based on Enn answer). I found that UseUrls and UseIIS are not necessary.

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
            webBuilder.UseKestrel()
                .ConfigureKestrel(options =>
                {
                    options.ListenAnyIP(5000);
                });
        });
lucapan
  • 81
  • 1
  • 4