Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
1b8a452a
Commit
1b8a452a
authored
Jan 11, 2022
by
lcx
Committed by
纪旭 韦
Jan 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
记录过期限制异常
parent
745414c8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
performance/Performance.Api/Middlewares/FunctionLimit.cs
+6
-4
performance/Performance.Api/Program.cs
+1
-1
No files found.
performance/Performance.Api/Middlewares/FunctionLimit.cs
View file @
1b8a452a
...
@@ -14,17 +14,19 @@ public class LimitInformation
...
@@ -14,17 +14,19 @@ public class LimitInformation
public
class
FunctionLimit
public
class
FunctionLimit
{
{
public
static
LimitInformation
Limit
{
get
;
}
=
new
LimitInformation
();
public
static
LimitInformation
Limit
{
get
;
}
=
new
LimitInformation
();
public
static
void
Init
()
public
static
void
Init
(
NLog
.
Logger
logger
)
{
{
string
message
=
"此网站的验证证书有问题,验证证书已过期或还未生效,请及时联系供应厂商进行维护升级。"
;
string
message
=
"此网站的验证证书有问题,验证证书已过期或还未生效,请及时联系供应厂商进行维护升级。"
;
var
filePath
=
Path
.
Combine
(
Environment
.
CurrentDirectory
,
"secret.key"
);
var
filePath
=
Path
.
Combine
(
Environment
.
CurrentDirectory
,
"secret.key"
);
logger
.
Info
(
filePath
);
if
(!
File
.
Exists
(
filePath
))
if
(!
File
.
Exists
(
filePath
))
{
{
Limit
.
ExpirationTime
=
DateTime
.
MinValue
;
Limit
.
ExpirationTime
=
DateTime
.
MinValue
;
Limit
.
Remark
=
message
;
Limit
.
Remark
=
message
;
return
;
return
;
}
}
string
content
=
ReadLimitContent
(
filePath
);
string
content
=
ReadLimitContent
(
filePath
,
logger
);
logger
.
Info
(
content
);
if
(
string
.
IsNullOrEmpty
(
content
))
if
(
string
.
IsNullOrEmpty
(
content
))
{
{
Limit
.
ExpirationTime
=
DateTime
.
MinValue
;
Limit
.
ExpirationTime
=
DateTime
.
MinValue
;
...
@@ -57,7 +59,7 @@ private static long ConvertToExpiration(string content)
...
@@ -57,7 +59,7 @@ private static long ConvertToExpiration(string content)
return
result
;
return
result
;
}
}
private
static
string
ReadLimitContent
(
string
filePath
)
private
static
string
ReadLimitContent
(
string
filePath
,
NLog
.
Logger
logger
)
{
{
var
content
=
""
;
var
content
=
""
;
try
try
...
@@ -68,7 +70,7 @@ private static string ReadLimitContent(string filePath)
...
@@ -68,7 +70,7 @@ private static string ReadLimitContent(string filePath)
content
=
reader
.
ReadToEnd
();
content
=
reader
.
ReadToEnd
();
}
}
}
}
catch
(
Exception
)
{
}
catch
(
Exception
ex
)
{
logger
.
Error
(
ex
);
}
return
content
;
return
content
;
}
}
...
...
performance/Performance.Api/Program.cs
View file @
1b8a452a
...
@@ -11,8 +11,8 @@ public class Program
...
@@ -11,8 +11,8 @@ public class Program
{
{
public
static
void
Main
(
string
[]
args
)
public
static
void
Main
(
string
[]
args
)
{
{
FunctionLimit
.
Init
();
var
logger
=
NLogBuilder
.
ConfigureNLog
(
"nlog.config"
).
GetCurrentClassLogger
();
var
logger
=
NLogBuilder
.
ConfigureNLog
(
"nlog.config"
).
GetCurrentClassLogger
();
FunctionLimit
.
Init
(
logger
);
try
try
{
{
CreateWebHostBuilder
(
args
).
Build
().
Run
();
CreateWebHostBuilder
(
args
).
Build
().
Run
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment