Commit 765538cf by zxw

修复文件编码为utf8

parent 6bed92a5
...@@ -24,7 +24,7 @@ namespace JunmpPoliceStation ...@@ -24,7 +24,7 @@ namespace JunmpPoliceStation
var process = Process.GetProcessesByName("JunmpPoliceStation"); var process = Process.GetProcessesByName("JunmpPoliceStation");
if (process.Length > 1) if (process.Length > 1)
{ {
Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}] - 已有另一个进程正在运行中..."); Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}] - 已有另一个进程正在运行中...");
Console.ReadKey(); Console.ReadKey();
} }
else else
......
...@@ -63,13 +63,13 @@ namespace JunmpPoliceStation ...@@ -63,13 +63,13 @@ namespace JunmpPoliceStation
GlobalContext.UseNoticeService(new Uri(msg_uri)); GlobalContext.UseNoticeService(new Uri(msg_uri));
if (GlobalContext.ServerNum <= 0 || GlobalContext.ServerNum > 15) if (GlobalContext.ServerNum <= 0 || GlobalContext.ServerNum > 15)
{ {
throw new Exception("服务器编号不正确,应是1-15之间的数字,请检查JSON配置ServerNum字段。"); throw new Exception("服务器编号不正确,应是1-15之间的数字,请检查JSON配置ServerNum字段。");
} }
else else
{ {
services.AddSession(); services.AddSession();
services.AddTransient(typeof(UnitOfWork));//注入工作单元 services.AddTransient(typeof(UnitOfWork));//注入工作单元
//配置跨域处理,允许所有来源 //配置跨域处理,允许所有来源
services.AddCors(options => services.AddCors(options =>
{ {
options.AddPolicy("cors", options.AddPolicy("cors",
...@@ -101,19 +101,19 @@ namespace JunmpPoliceStation ...@@ -101,19 +101,19 @@ namespace JunmpPoliceStation
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddMvc().AddWebApiConventions(); services.AddMvc().AddWebApiConventions();
services.AddMvc().AddControllersAsServices(); services.AddMvc().AddControllersAsServices();
//配置Swagger //配置Swagger
//注册Swagger生成器,定义一个Swagger 文档 //注册Swagger生成器,定义一个Swagger 文档
services.AddSwaggerGen(c => services.AddSwaggerGen(c =>
{ {
c.DocumentFilter<SwaggerIgnoreFilter>(); c.DocumentFilter<SwaggerIgnoreFilter>();
c.SwaggerDoc("v1", new OpenApiInfo c.SwaggerDoc("v1", new OpenApiInfo
{ {
Version = "v1", Version = "v1",
Title = "警用仓库管理平台接口", Title = "警用仓库管理平台接口",
Description = "仓库API" Description = "仓库API"
}); });
// 为 Swagger 设置xml文档注释路径 // 为 Swagger 设置xml文档注释路径
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath); c.IncludeXmlComments(xmlPath);
...@@ -130,7 +130,7 @@ namespace JunmpPoliceStation ...@@ -130,7 +130,7 @@ namespace JunmpPoliceStation
.AddNacosConfig(Configuration) .AddNacosConfig(Configuration)
.AddNacosAspNetCore(Configuration); .AddNacosAspNetCore(Configuration);
//启动MQTT //启动MQTT
//var mqtt = new MQTTServer(connection); //var mqtt = new MQTTServer(connection);
//mqtt.StartMqttServer(Configuration); //mqtt.StartMqttServer(Configuration);
//services.AddSingleton(mqtt); //services.AddSingleton(mqtt);
...@@ -145,9 +145,9 @@ namespace JunmpPoliceStation ...@@ -145,9 +145,9 @@ namespace JunmpPoliceStation
services.AddSingleton<MQTTServer>(); services.AddSingleton<MQTTServer>();
services.AddHangfire(configuration => configuration services.AddHangfire(configuration => configuration
.UseMemoryStorage());//使用内存 .UseMemoryStorage());//使用内存
services.AddHangfireServer();//添加hangfire服务 services.AddHangfireServer();//添加hangfire服务
services.AddScoped<CronJob>();//注册执行类 services.AddScoped<CronJob>();//注册执行类
services.Configure<ForwardedHeadersOptions>(options => services.Configure<ForwardedHeadersOptions>(options =>
{ {
...@@ -181,9 +181,9 @@ namespace JunmpPoliceStation ...@@ -181,9 +181,9 @@ namespace JunmpPoliceStation
app.UseSession(); app.UseSession();
//启用中间件服务生成Swagger作为JSON终结点 //启用中间件服务生成Swagger作为JSON终结点
app.UseSwagger(); app.UseSwagger();
//启用中间件服务对swagger-ui,指定Swagger JSON终结点 //启用中间件服务对swagger-ui,指定Swagger JSON终结点
app.UseSwaggerUI(c => app.UseSwaggerUI(c =>
{ {
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
...@@ -195,8 +195,8 @@ namespace JunmpPoliceStation ...@@ -195,8 +195,8 @@ namespace JunmpPoliceStation
//app.UseAuthorization(); //app.UseAuthorization();
app.UseRouting(); app.UseRouting();
//允许所有跨域,cors是在ConfigureServices方法中配置的跨域策略名称 //允许所有跨域,cors是在ConfigureServices方法中配置的跨域策略名称
//注意:UseCors必须放在UseRouting和UseEndpoints之间 //注意:UseCors必须放在UseRouting和UseEndpoints之间
app.UseCors("cors"); app.UseCors("cors");
app.UseAuthentication(); app.UseAuthentication();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
...@@ -223,7 +223,7 @@ namespace JunmpPoliceStation ...@@ -223,7 +223,7 @@ namespace JunmpPoliceStation
// template: "{controller=Home}/{action=Index}/{id?}"); // template: "{controller=Home}/{action=Index}/{id?}");
//}); //});
//注册nacos服务 //注册nacos服务
//_namingClient.RegisterInstanceAsync(new RegisterInstanceRequest() //_namingClient.RegisterInstanceAsync(new RegisterInstanceRequest()
//{ //{
// ServiceName = "JunmpPoliceStation12", // ServiceName = "JunmpPoliceStation12",
...@@ -245,7 +245,7 @@ namespace JunmpPoliceStation ...@@ -245,7 +245,7 @@ namespace JunmpPoliceStation
public class Setting public class Setting
{ {
/// <summary> /// <summary>
/// 数据库连接字符串 /// 数据库连接字符串
/// </summary> /// </summary>
public string MySqlConnection { get; set; } public string MySqlConnection { get; set; }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论