[英]Unable to Load swagger API page, missing swagger-ui.css
I am trying to add swagger to my service, but I am having some problems.我正在尝试为我的服务添加 swagger,但我遇到了一些问题。 When I go to my page I get multiple calls to my webpage
当我转到我的页面时,我的网页收到了多次调用
If I go to localhost/api/myServiceName/swagger/v1/swagger.json, the file looks ok.如果我转到 localhost/api/myServiceName/swagger/v1/swagger.json,该文件看起来没问题。 I can see my endpoints and DTOs.
我可以看到我的端点和 DTO。
In my code I do the following:在我的代码中,我执行以下操作:
ConfigureServices():
services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { Title = "MyService API", Version = "v1" }); });
Configure():
app.UseSwagger();
app.UseSwaggerUI(
c =>
{
c.SwaggerEndpoint($"/api/MyService/swagger/v1/swagger.json",
"MyService API V1");
});
My project references:我的项目参考:
I am pretty sure something is wrong with my configuration.我很确定我的配置有问题。 Any idea on what the error is?
知道错误是什么吗?
Add a reference to Microsoft.AspNetCore.StaticFiles添加对 Microsoft.AspNetCore.StaticFiles 的引用
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/851 https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/851
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.