Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
WeiPanAPI
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Discuz
WeiPanAPI
Commits
fe2180bd
Commit
fe2180bd
authored
Jan 19, 2021
by
xiongyuwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Startup.cs
parent
9c81b280
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
Startup.cs
src/Bailun.Discuz.Service/Startup/Startup.cs
+11
-20
No files found.
src/Bailun.Discuz.Service/Startup/Startup.cs
View file @
fe2180bd
...
...
@@ -34,7 +34,7 @@ namespace Bailun.Discuz
services
.
AddMicroServiceApi
<
ITaskJobApi
>(
ConfigManagerConf
.
GetValue
(
"ApiServerUrl:TaskJobUrl"
));
//
扩大接口能接收的post容量
//
扩大接口能接收的post容量
services
.
Configure
<
FormOptions
>(
options
=>
{
options
.
ValueCountLimit
=
int
.
MaxValue
;
// 2000 items max
...
...
@@ -54,17 +54,8 @@ namespace Bailun.Discuz
// var factory = p.GetRequiredService<IHttpApiFactory<IProductApi>>();
// return factory.CreateHttpApi();
//});
//添加cors 服务 配置跨域处理
services
.
AddCors
(
options
=>
{
options
.
AddPolicy
(
"any"
,
builder
=>
{
builder
.
WithMethods
(
"GET"
,
"POST"
,
"HEAD"
,
"PUT"
,
"DELETE"
,
"OPTIONS"
)
//.AllowCredentials()//指定处理cookie
.
AllowAnyOrigin
();
//允许任何来源的主机访问
});
});
//注入日志
//注入日志
services
.
AddSingleton
<
ILessLog
,
LessLog
>();
return
services
.
AddAbpService
<
ServiceModule
,
BaseContext
>(
_appConfiguration
);
}
...
...
@@ -79,7 +70,7 @@ namespace Bailun.Discuz
}
/// <summary>
///
默认提交异常处理事件
///
默认提交异常处理事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
...
...
@@ -91,31 +82,31 @@ namespace Bailun.Discuz
e
.
Cancel
=
true
;
return
;
}
//
只处理未处理的异常
//
只处理未处理的异常
if
(!
e
.
IsUnhandledError
)
return
;
//
忽略没有错误体的错误
//
忽略没有错误体的错误
var
error
=
argEvent
.
GetError
();
if
(
error
==
null
)
return
;
//
忽略404错误
//
忽略404错误
if
(
e
.
Event
.
IsNotFound
())
{
e
.
Cancel
=
true
;
return
;
}
//
忽略401(Unauthorized)和请求验证的错误
.
//
忽略401(Unauthorized)和请求验证的错误.
if
(
error
.
Code
==
"401"
)
{
e
.
Cancel
=
true
;
return
;
}
//
忽略任何未被代码抛出的异常
//
忽略任何未被代码抛出的异常
var
handledNamespaces
=
new
List
<
string
>
{
"Exceptionless"
};
var
handledNamespaceList
=
error
.
StackTrace
.
Select
(
s
=>
s
.
DeclaringNamespace
).
Distinct
();
if
(!
handledNamespaceList
.
Any
(
ns
=>
handledNamespaces
.
Any
(
ns
.
Contains
)))
...
...
@@ -124,8 +115,8 @@ namespace Bailun.Discuz
return
;
}
e
.
Event
.
Tags
.
Add
(
"
未捕获异常"
);
//添加系统异常标签
e
.
Event
.
MarkAsCritical
();
//
标记为关键异常
e
.
Event
.
Tags
.
Add
(
"
未捕获异常"
);
//添加系统异常标签
e
.
Event
.
MarkAsCritical
();
//
标记为关键异常
}
}
...
...
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