[ad_1]
While working through the Create a web API with ASP.NET Core tutorial, I hit a snag with the certs.
When I run dotnet dev-certs https
, I receive A valid HTTPS certificate is already present
. And it is, expiring in 2024.
But when I run, I receive: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
How do I configure the WebAPI program to use a cert in the Keychain?
I haven’t done any configuration to the program–I am trying to stick close to the tutorial. But this is what dotnet
creates:
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
[ad_2]