Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
JunmpPoliceStation
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
zxw
JunmpPoliceStation
Commits
765538cf
Commit
765538cf
authored
Mar 15, 2023
by
zxw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复文件编码为utf8
parent
6bed92a5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
19 行删除
+19
-19
MsgPushService.cs
JmpMsgService/MsgPushService.cs
+0
-0
Program.cs
JunmpPoliceStation/Program.cs
+1
-1
Startup.cs
JunmpPoliceStation/Startup.cs
+18
-18
没有找到文件。
JmpMsgService/MsgPushService.cs
View file @
765538cf
差异被折叠。
点击展开。
JunmpPoliceStation/Program.cs
View file @
765538cf
...
...
@@ -24,7 +24,7 @@ namespace JunmpPoliceStation
var
process
=
Process
.
GetProcessesByName
(
"JunmpPoliceStation"
);
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
();
}
else
...
...
JunmpPoliceStation/Startup.cs
View file @
765538cf
...
...
@@ -63,13 +63,13 @@ namespace JunmpPoliceStation
GlobalContext
.
UseNoticeService
(
new
Uri
(
msg_uri
));
if
(
GlobalContext
.
ServerNum
<=
0
||
GlobalContext
.
ServerNum
>
15
)
{
throw
new
Exception
(
"
服务器编号不正确,应是1-15之间的数字,请检查JSON配置ServerNum字段。
"
);
throw
new
Exception
(
"
服务器编号不正确,应是1-15之间的数字,请检查JSON配置ServerNum字段。"
);
}
else
{
services
.
AddSession
();
services
.
AddTransient
(
typeof
(
UnitOfWork
));
//
注入工作单元
//
配置跨域处理,允许所有来源
services
.
AddTransient
(
typeof
(
UnitOfWork
));
//
注入工作单元
//
配置跨域处理,允许所有来源
services
.
AddCors
(
options
=>
{
options
.
AddPolicy
(
"cors"
,
...
...
@@ -101,19 +101,19 @@ namespace JunmpPoliceStation
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_3_0
);
services
.
AddMvc
().
AddWebApiConventions
();
services
.
AddMvc
().
AddControllersAsServices
();
//
配置
Swagger
//
注册Swagger生成器,定义一个Swagger 文档
//
配置S
wagger
//
注册Swagger生成器,定义一个Swagger 文档
services
.
AddSwaggerGen
(
c
=>
{
c
.
DocumentFilter
<
SwaggerIgnoreFilter
>();
c
.
SwaggerDoc
(
"v1"
,
new
OpenApiInfo
{
Version
=
"v1"
,
Title
=
"
警用仓库管理平台接口
"
,
Description
=
"
仓库
API"
Title
=
"
警用仓库管理平台接口"
,
Description
=
"
仓库A
PI"
});
//
为 Swagger 设置xml文档注释路径
//
为 Swagger 设置xml文档注释路径
var
xmlFile
=
$"
{
Assembly
.
GetExecutingAssembly
().
GetName
().
Name
}
.xml"
;
var
xmlPath
=
Path
.
Combine
(
AppContext
.
BaseDirectory
,
xmlFile
);
c
.
IncludeXmlComments
(
xmlPath
);
...
...
@@ -130,7 +130,7 @@ namespace JunmpPoliceStation
.
AddNacosConfig
(
Configuration
)
.
AddNacosAspNetCore
(
Configuration
);
//
启动
MQTT
//
启动M
QTT
//var mqtt = new MQTTServer(connection);
//mqtt.StartMqttServer(Configuration);
//services.AddSingleton(mqtt);
...
...
@@ -145,9 +145,9 @@ namespace JunmpPoliceStation
services
.
AddSingleton
<
MQTTServer
>();
services
.
AddHangfire
(
configuration
=>
configuration
.
UseMemoryStorage
());
//
使用内存
services
.
AddHangfireServer
();
//
添加hangfire服务
services
.
AddScoped
<
CronJob
>();
//
注册执行类
.
UseMemoryStorage
());
//
使用内存
services
.
AddHangfireServer
();
//
添加hangfire服务
services
.
AddScoped
<
CronJob
>();
//
注册执行类
services
.
Configure
<
ForwardedHeadersOptions
>(
options
=>
{
...
...
@@ -181,9 +181,9 @@ namespace JunmpPoliceStation
app
.
UseSession
();
//
启用中间件服务生成Swagger作为JSON终结点
//
启用中间件服务生成Swagger作为JSON终结点
app
.
UseSwagger
();
//
启用中间件服务对swagger-ui,指定Swagger JSON终结点
//
启用中间件服务对swagger-ui,指定Swagger JSON终结点
app
.
UseSwaggerUI
(
c
=>
{
c
.
SwaggerEndpoint
(
"/swagger/v1/swagger.json"
,
"My API V1"
);
...
...
@@ -195,8 +195,8 @@ namespace JunmpPoliceStation
//app.UseAuthorization();
app
.
UseRouting
();
//
允许所有跨域,cors是在ConfigureServices方法中配置的跨域策略名称
//
注意:UseCors必须放在UseRouting和UseEndpoints之间
//
允许所有跨域,cors是在ConfigureServices方法中配置的跨域策略名称
//
注意:UseCors必须放在UseRouting和UseEndpoints之间
app
.
UseCors
(
"cors"
);
app
.
UseAuthentication
();
app
.
UseEndpoints
(
endpoints
=>
...
...
@@ -223,7 +223,7 @@ namespace JunmpPoliceStation
// template: "{controller=Home}/{action=Index}/{id?}");
//});
//
注册nacos服务
//
注册nacos服务
//_namingClient.RegisterInstanceAsync(new RegisterInstanceRequest()
//{
// ServiceName = "JunmpPoliceStation12",
...
...
@@ -245,7 +245,7 @@ namespace JunmpPoliceStation
public
class
Setting
{
/// <summary>
///
数据库连接字符串
///
数据库连接字符串
/// </summary>
public
string
MySqlConnection
{
get
;
set
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论