我試圖在新的asp.net CORE/MVC 6項目中設置一個基本的swagger API文檔,並從swagger用戶界面接收到500錯誤: 500 : http://localhost:4405/swagger/v1/swagger.json
在asp.net中設置Swagger時出現錯誤CORE/MVC 6 app
我的啓動類中有下面的代碼:
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"
});
});
}
,然後配置下:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
....
app.UseSwaggerGen();
app.UseSwaggerUi();
....
}
當我建立並運行該項目,該UI會出現,當我去swagger/UI/index.html,但500錯誤上面顯示。當我去招搖/ V1/swagger.json鏈接,控制檯提供了以下500錯誤: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
有什麼辦法,我可以找出500的根本原因或招搖圖使任何額外的調試爲什麼它拋出這個錯誤?根據我所看到的一些教程,只有我在啓動時需要基礎實施。請讓我知道我是否可以提供任何其他信息。
編輯:這是RC1,並可能不相關的新磊目前1.0了(2016年6月29日)
我確認了此修復程序。 – mabead
也爲我工作。 –
也爲我工作。 –