in .net 9, Wed appi is created in dot net core, scalar api documentation library is installed but not working why?
.net 9
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
in .net 9, Wed appi is created in dot net core, scalar api documentation library is installed but not working why?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sangeetha SRank #212 · 11.4K reputationPosted Jun 23, 2025, 6:44 AM EDT
Make sure you have the latest version of
Scalar.AspNetCoreinstalled:dotnet add package Scalar.AspNetCore
In
.NET 9, you should configure it like this inProgram.cs:using Scalar.AspNetCore; var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); builder.Services.AddOpenApi(); // Registers OpenAPI generation var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.MapOpenApi(); // Serves the OpenAPI JSON app.MapScalarApiReference(options => { options.WithTitle("My API"); options.WithOpenApiRoutePattern("/openapi/v1.json"); // Important! }); } app.MapControllers(); app.Run();Scalar expects the OpenAPI document to be available at
/openapi/v1.jsonby default. If your document is named differently or not mapped, Scalar will show a blank page.Ensure the document is accessible at the expected path, or update the route pattern in
MapScalarApiReference.