1.swagger error 有詳細的錯誤信息web
2.swagger error 無詳細的錯誤信息json
3.swagger無註釋api
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Platform.Service.Enterprise.WebApi API", Version = "v1.0.0.0" }); c.DescribeAllEnumsAsStrings(); var basePath = PlatformServices.Default.Application.ApplicationBasePath; var docPath = Path.Combine(basePath, "Docs"); var docs = XMLUtil.CreateXPathDocumentsFromDirectory(docPath); docs.ForEach(xp => c.IncludeXmlComments(() => { return xp; })); });
app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Platform Enterprise WebApi API"); });