Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL error in .NET Core 3 Linux app on azure

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?

like image 796
Enn Avatar asked Sep 18 '19 11:09

Enn


2 Answers

This seems to be familiar issue, try the following

dotnet dev-certs https --clean
dotnet dev-certs https -t
like image 75
Sajeetharan Avatar answered Oct 18 '22 20:10

Sajeetharan


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.

like image 38
Enn Avatar answered Oct 18 '22 19:10

Enn