我正在尝试在新的asp .net CORE/MVC 6项目中设置一个基本的swagger API文档,并从swagger UI接收500错误:
500 : http://localhost:4405/swagger/v1/swagger.json
我的启动类中包含以下代码:
using Swashbuckle.SwaggerGen;
using Swashbuckle.SwaggerGen.XmlComments;
using Swashbuckle.Application;
....
public void ConfigureServices(IServiceCollection services)
{
...
services.AddSwaggerGen();
services.ConfigureSwaggerDocument(options =>
{
options.SingleApiVersion(new Info
{
Version = "v1",
Title = "Blog Test Api",
Description = "A test API for this blogpost"
});
});
}
Run Code Online (Sandbox Code Playgroud)
然后在Configure下:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
....
app.UseSwaggerGen();
app.UseSwaggerUi();
....
}
Run Code Online (Sandbox Code Playgroud)
当我构建并运行项目时,当我转到swagger/UI/index.html时,UI会出现,但会显示上面的500错误.当我转到swagger/v1/swagger.json链接时,控制台会给出以下500错误:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) …
当我访问swagger url:时http://localhost:28483/swagger/ui/index,它会生成此错误:
500 : undefined http://localhost:28483/swagger/docs/v1
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新:在firebug中查看此详细信息错误:
Not supported by Swagger 2.0: Multiple operations
with path 'api/BimModel' and method 'GET'. See the config setting - \"ResolveConflictingActions\" for
a potential workaround
Run Code Online (Sandbox Code Playgroud)