标签:path ica option inf rect nbsp app on() contex
1、首先参考:我的第一个netcore2.2 api项目搭建(一) https://www.cnblogs.com/sy-ds/p/10832504.html
启用身份验证 Startup 中增加 app.UseAuthentication();
二、使用 Swagger 的过程:
1、nuget搜索:Swashbuckle.AspNetCore,安装 Swagger 工具 Nuget包。
2、在startup 的 ConfigureServices 中 注册swagger
services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { //Version = "v1", Title = "MyFirst API",//" API", }); // Set the comments path for the Swagger JSON and UI. var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); options.IncludeXmlComments(xmlPath, true); xmlPath = Path.Combine(AppContext.BaseDirectory, "JH.OPEMR.Model.xml"); options.IncludeXmlComments(xmlPath, true);
});
3、在Configure中启用swagger
app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint. app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); });
NetCore WebApi 应用事项,验证,授权,数据库Orm(EFCore、XPO等)
标签:path ica option inf rect nbsp app on() contex
原文地址:https://www.cnblogs.com/hopesun/p/11405726.html