设置了RoutePrefix访问就会报错
Closed this issue · 3 comments
userlm commented
设置了RoutePrefix访问就会报错,加载不出接口文档
luoyunchong commented
目前只能这样,请求是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");
});
YYHEggEgg commented
就是说这个 nuget 解决不了?这种是不是应该算作 not planned 而不是 completed
lc1055 commented
app.UseKnife4UI(c => { c.RoutePrefix = "doc"; c.SwaggerEndpoint($"../{app.Key}/swagger.json", app.Value); });
路径里加上 ../ 居然有效~