瀏覽代碼

uft-8 编码

td_orm
H Vs 1 年之前
父節點
當前提交
45771a2351
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. +9
    -9
      HealthMonitor.WebApi/Program.cs

+ 9
- 9
HealthMonitor.WebApi/Program.cs 查看文件

@@ -1,4 +1,4 @@
using AspectCore.Extensions.DependencyInjection;
锘縰sing AspectCore.Extensions.DependencyInjection;
using HealthMonitor.Common;
using HealthMonitor.Common.helper;
using HealthMonitor.Core.Cache;
@@ -39,7 +39,7 @@ namespace HealthMonitor.WebApi
public static void Main(string[] args)
{

//选择配置文件appsetting.json
//閫夋嫨閰嶇疆鏂囦欢appsetting.json
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
@@ -56,7 +56,7 @@ namespace HealthMonitor.WebApi

builder.Services.AddHttpClient(Consts.DEFAULT_HTTPCLIENT_NAME, c =>
{
c.Timeout = TimeSpan.FromSeconds(10); //超时限制
c.Timeout = TimeSpan.FromSeconds(10); //瓒呮椂闄愬埗
c.DefaultRequestHeaders.Add("Accept", "application/json");
//c.DefaultRequestHeaders.Connection.Add("keep-alive");
});
@@ -72,7 +72,7 @@ namespace HealthMonitor.WebApi
builder.Services.AddSwaggerGen();


#region scoped MySQL 数据库
#region scoped MySQL 鏁版嵁搴�
builder.Services // gps_card
.AddDbContextPool<GpsCardContext>((sp, options) =>
{
@@ -161,7 +161,7 @@ namespace HealthMonitor.WebApi
.AddSingleton<IHealthMonitorOperatorManager, HealthMonitorOperatorRedisManager>();
//builder.Services.AddSingleton<IHealthMonitorOperatorManager, HealthMonitorOperatorRedisManager>();
//用AspectCore替换默认的IOC容器
//鐢ˋspectCore鏇挎崲榛樿�鐨処OC瀹瑰櫒
builder.Host.UseServiceProviderFactory(new DynamicProxyServiceProviderFactory());
#endregion

@@ -203,8 +203,8 @@ namespace HealthMonitor.WebApi
// Register the Swagger generator, defining 1 or more Swagger documents
builder.Services.AddSwaggerGen(c =>
{
//c.SwaggerDoc(AppConsts.SWAGGER_DOC_GpsCard, new OpenApiInfo { Title = "GpsCard模块", Version = "v1", Description = "gps_card数据库服务" }); //分组显示
c.SwaggerDoc(AppConsts.SWAGGER_DOC_HealthMonitor, new OpenApiInfo { Title = "HealthMonitor模块", Version = "v1", Description = "health_monitor数据库服务" }); //分组显示
//c.SwaggerDoc(AppConsts.SWAGGER_DOC_GpsCard, new OpenApiInfo { Title = "GpsCard妯″潡", Version = "v1", Description = "gps_card鏁版嵁搴撴湇鍔�" }); //鍒嗙粍鏄剧ず
c.SwaggerDoc(AppConsts.SWAGGER_DOC_HealthMonitor, new OpenApiInfo { Title = "HealthMonitor妯″潡", Version = "v1", Description = "health_monitor鏁版嵁搴撴湇鍔�" }); //鍒嗙粍鏄剧ず


c.DocumentFilter<EnumDocumentFilter>();
@@ -254,8 +254,8 @@ namespace HealthMonitor.WebApi
app.UseSwaggerUI(c =>
{
string sub = string.IsNullOrEmpty(prefix) ? "" : $"/{prefix}";
//c.SwaggerEndpoint($"{sub}/{AppConsts.SWAGGER_DOC_GpsCard}/api-docs/", "GpsCard模块"); //分组显示
c.SwaggerEndpoint($"{sub}/{AppConsts.SWAGGER_DOC_HealthMonitor}/api-docs/", "HealthMonitor模块"); //分组显示
//c.SwaggerEndpoint($"{sub}/{AppConsts.SWAGGER_DOC_GpsCard}/api-docs/", "GpsCard妯″潡"); //鍒嗙粍鏄剧ず
c.SwaggerEndpoint($"{sub}/{AppConsts.SWAGGER_DOC_HealthMonitor}/api-docs/", "HealthMonitor妯″潡"); //鍒嗙粍鏄剧ず
c.RoutePrefix = string.Empty;
});


Loading…
取消
儲存