I’m trying to enable HTTPS in my .NET Core 8 application using a self-signed certificate for local development. I’ve generated the certificate using OpenSSL and added it to my project, but I’m encountering errors when trying to configure Kestrel to use it.
Below is what my Startup.cs
looks like:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseHttps("certificate.pfx", "password"); // Configuring HTTPS with the self-signed certificate
}
The above code directs me to the below error:
Unhandled exception. System.InvalidOperationException: Unable to
configure HTTPS endpoint. No server certificate was specified, and the
default developer certificate could not be found.
I’ve followed the official documentation on Microsoft’s website for configuring HTTPS in .NET Core, but I’m still stuck with no luck. Any help would be greatly appreciated.
5