IGeekFan.AspNetCore.Knife4jUI icon indicating copy to clipboard operation
IGeekFan.AspNetCore.Knife4jUI copied to clipboard

设置了RoutePrefix访问就会报错

Open userlm opened this issue 3 years ago • 1 comments

设置了RoutePrefix访问就会报错,加载不出接口文档

userlm avatar Aug 10 '22 01:08 userlm

目前只能这样,请求是Knife4j内部请求的,这边控制不了

    app.UseSwagger();
    app.UseKnife4UI(c =>
    {
        c.RoutePrefix = "k4"; // serve the UI at root
        c.SwaggerEndpoint("/v1/swagger.json", "V1 Docs");
    });c
app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
    endpoints.MapSwagger("/k4/{documentName}/swagger.json");
});

luoyunchong avatar Aug 16 '22 14:08 luoyunchong

就是说这个 nuget 解决不了?这种是不是应该算作 not planned 而不是 completed

YYHEggEgg avatar Jan 12 '24 13:01 YYHEggEgg

app.UseKnife4UI(c => { c.RoutePrefix = "doc"; c.SwaggerEndpoint($"../{app.Key}/swagger.json", app.Value); });

路径里加上 ../ 居然有效~

lc1055 avatar Jan 25 '24 11:01 lc1055