I have a problem when deploying an ASP.NET Core Web API to my IIS. I can't access scalar UI using '/scalar/v1' everything just white.
When I run it locally, everything is ok, I can test my API directly or using Postman. It just happens when deploying to IIS.
Program.cs
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger(options =>
{
options.RouteTemplate = "/openapi/{documentName}.json";
});
app.MapScalarApiReference(options =>
{
options.Title = "My - API";
});
}
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();
I tried to include and remove the environment checking since this was checked as an answer but I'm still having the same problem
// Configure the HTTP request pipeline.
//if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
//{
app.UseSwagger(options =>
{
options.RouteTemplate = "/openapi/{documentName}.json";
});
app.MapScalarApiReference(options =>
{
options.Title = "CPS - API";
});
//}
