I have a .net core API that runs fine under http but when I check to enable SSL it won't even load program or startup.cs.
I suspect some sort of IIS Express or Binding issue but I don't see anything wrong.
LaunchSettings:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5001/",
"sslPort": 45150
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Bullies.API": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:45150;http://localhost:5001"
}
}
}
I've restarted VS 2019 several times and I am running in Admin mode.
I've cleaned out all certs with:
dotnet dev-certs https --clean
And recreated with
dotnet dev-certs https --trust
In the browser I get no error messages that mean anything to me just ERR_CONNECTION_RESET and this header.
Request URL: https://localhost:45150/
Referrer Policy: strict-origin-when-cross-origin
Provisional headers are shown
sec-ch-ua: "Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
What am I missing?
Edit
Added program.cs:
public class Program
{
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
try
{
Log.Information("Starting up");
CreateHostBuilder(args).Build().Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Application start-up failed");
}
finally
{
Log.CloseAndFlush();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Stuff>();
});
}
Solved
This is what finally did it. Recreating the IIS Express Certs: