appsettings.json 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. {
  2. "Sers": {
  3. /* 通讯层配置 */
  4. "CL": {
  5. /* 共用配置,子项共用,覆写子项未指定的配置 */
  6. "Config": {
  7. "workThread": {
  8. // 模式,可为 LongThread(默认)、LongThread_TimeLimit、ManagedThread、ConsumerCascade
  9. "mode": "LongThread",
  10. /* 后台处理消息的线程个数(单位个,默认2) */
  11. "threadCount": 2,
  12. /* 最大线程数(包含常驻线程和临时线程),默认100。仅当mode为ManagedThread时有效 */
  13. "maxThreadCount": 100,
  14. /* 等待队列的最大长度(默认:100000)。仅当mode为LongThread_TimeLimit和ManagedThread时有效 */
  15. "pendingQueueLength": 100000,
  16. /* 超时时间(单位ms,默认300000),仅当mode为LongThread_TimeLimit、ManagedThread时有效 */
  17. "timeoutMs": 300000
  18. },
  19. /* 请求超时时间(单位ms,默认300000) */
  20. "requestTimeoutMs": 300000,
  21. //HeartBeat
  22. /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
  23. "heartBeatIntervalMs": 10000,
  24. /* 心跳检测超时时间(单位ms,默认30000) */
  25. "heartBeatTimeoutMs": 30000,
  26. /* 心跳检测失败重试次数(单位次,默认10) */
  27. "heartBeatRetryCount": 10,
  28. /* 数据传输 加密协议,可多个,可不指定 */
  29. "//security": [
  30. {
  31. // SampleSecurity
  32. /* 在此Assembly中查找security */
  33. "assemblyFile": "Sers.Core.dll",
  34. /* the class of security in assemblyFile. 必须继承接口 Sers.Core.Util.StreamSecurity.ISecurity */
  35. "className": "Sers.Core.Util.StreamSecurity.Security.SampleSecurity",
  36. /* (x.2) config */
  37. /* 加密密钥 */
  38. "secret": "security"
  39. },
  40. {
  41. // SampleSecurity
  42. /* 若不指定assemblyFile和className 则默认为Sers.Core.Util.StreamSecurity.Security.SampleSecurity */
  43. "secret": "Two layer encryption"
  44. }
  45. ],
  46. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  47. "secretKey": "SersCL"
  48. },
  49. /* one conn is one channel.can be multiable */
  50. "Server": [
  51. {
  52. //Ipc.NamedPipe
  53. /* (x.1) type */
  54. /* 在此Assembly中查找builder */
  55. "assemblyFile": "Sers.CL.Ipc.NamedPipe.dll",
  56. /* the class of builder in assemblyFile */
  57. //"className": "Sers.CL.Ipc.NamedPipe.OrganizeServerBuilder",
  58. /* (x.2) config */
  59. /* 命名管道名称。例如: "Sers.CL.Ipc" */
  60. "pipeName": "Sers.CL.Ipc.4501"
  61. },
  62. {
  63. // Socket.Iocp
  64. /* (x.1) type - Iocp */
  65. /* the class of builder in assemblyFile */
  66. "className": "Sers.CL.Socket.Iocp.OrganizeServerBuilder",
  67. /* 通信模式(默认值:Simple)。可为 Simple、Timer、ThreadWait */
  68. //"mode": "ThreadWait",
  69. /* 接收缓存区大小(单位:byte,默认:8192) */
  70. //"receiveBufferSize": 8192,
  71. /* 发送缓冲区刷新间隔(单位:毫秒,默认:1)(仅当mode为Timer和ThreadWait时有效) */
  72. //"sendFlushInterval": 1,
  73. /* 发送缓冲区数据块的最小大小(单位:byte,默认 1000000)(仅当mode为Timer和ThreadWait时有效) */
  74. //"sendBufferSize": 1000000,
  75. /* 发送缓冲区个数(默认1024)(仅当mode为Timer和ThreadWait时有效) */
  76. //"sendBufferCount": 1024,
  77. /* (x.2) config */
  78. /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sers.cloud"。*/
  79. //"host": "127.0.0.1",
  80. /* 服务端 监听端口号。例如: 4501 */
  81. "port": 4501
  82. },
  83. {
  84. // Socket.ThreadWait
  85. /* (x.1) type - Socket */
  86. /* the class of builder in assemblyFile */
  87. //"className": "Sers.CL.Socket.ThreadWait.OrganizeServerBuilder",
  88. /* (x.2) config */
  89. /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sers.cloud"。*/
  90. //"host": "127.0.0.1",
  91. /* 服务端 监听端口号。例如: 4501 */
  92. "port": 4501
  93. },
  94. {
  95. // Zmq.ThreadWait
  96. /* (x.1) type */
  97. /* 在此Assembly中查找builder */
  98. "assemblyFile": "Sers.CL.ClrZmq.ThreadWait.dll",
  99. /* the class of builder in assemblyFile */
  100. //"className": "Sers.CL.ClrZmq.ThreadWait.OrganizeServerBuilder",
  101. /* (x.2) config */
  102. /* 地址。例如: "tcp://*:4502" 、 "ipc://4502" */
  103. "endpoint": "tcp://*:4502"
  104. },
  105. {
  106. // WebSocket
  107. /* (x.1) type - Iocp */
  108. /* 在此Assembly中查找builder */
  109. "assemblyFile": "Sers.CL.WebSocket.dll",
  110. /* the class of builder in assemblyFile */
  111. //"className": "Sers.CL.WebSocket.OrganizeServerBuilder",
  112. /* (x.2) config */
  113. /* 服务端地址(默认为 "ws://0.0.0.0:4503") */
  114. "host": "ws://0.0.0.0:4503"
  115. },
  116. {
  117. // Zmq.FullDuplex
  118. /* (x.1) type */
  119. /* 在此Assembly中查找builder */
  120. "assemblyFile": "Sers.CL.Zmq.FullDuplex.dll",
  121. /* the class of builder in assemblyFile */
  122. //"className": "Sers.CL.Zmq.FullDuplex.OrganizeServerBuilder",
  123. /* (x.2) config */
  124. /* 地址。例如: "tcp://*:4504" 、 "ipc://4504" */
  125. "endpoint": "tcp://*:4504"
  126. },
  127. {
  128. //Ipc.SharedMemory
  129. /* (x.1) type - Ipc.SharedMemory */
  130. /* 在此Assembly中查找builder */
  131. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  132. /* the class of builder in assemblyFile */
  133. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
  134. /* (x.2) config */
  135. /* 共享内存名称。例如: "ipcTest" */
  136. "name": "ipcForStationDemo",
  137. /* 共享内存节点个数。例如: 64 */
  138. "nodeCount": 128,
  139. /* 共享内存节点大小。例如: 2048 */
  140. "nodeBufferSize": 102400
  141. },
  142. {
  143. /* (x.1) type - Ipc.SharedMemory */
  144. /* 在此Assembly中查找builder */
  145. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  146. /* the class of builder in assemblyFile */
  147. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
  148. /* (x.2) config */
  149. /* 共享内存名称。例如: "ipcTest" */
  150. "name": "ipcForRobot",
  151. /* 共享内存节点个数。例如: 64 */
  152. "nodeCount": 128,
  153. /* 共享内存节点大小。例如: 2048 */
  154. "nodeBufferSize": 102400
  155. }
  156. ]
  157. },
  158. // RpcData序列化模式。可不指定。默认为Text。
  159. // 可为 Newtonsoft、Text、BytePointor。
  160. // 效率依次递增。BytePointor 序列化为二进制数据而不是json字符串。
  161. "RpcDataSerializeMode": "Text",
  162. /* LocalApiService 配置,可不指定 */
  163. "LocalApiService": {
  164. "workThread": {
  165. // 模式,可为 LongThread(默认)、LongThread_TimeLimit、ManagedThread、ConsumerCascade
  166. "mode": "LongThread",
  167. /* 后台服务的线程个数(单位个,默认16)(0代表不开启服务) */
  168. "threadCount": 4,
  169. /* 最大线程数(包含常驻线程和临时线程),默认100。仅当mode为ManagedThread时有效 */
  170. "maxThreadCount": 100,
  171. /* 等待队列的最大长度(默认:100000)。仅当mode为LongThread_TimeLimit和ManagedThread时有效 */
  172. "pendingQueueLength": 100000,
  173. /* 超时时间(单位ms,默认300000),仅当mode为LongThread_TimeLimit、ManagedThread时有效 */
  174. "timeoutMs": 300000
  175. },
  176. /* 静态文件映射器。映射站点静态文件,可多个,可不指定 */
  177. "//staticFiles": [
  178. {
  179. /* api路由前缀,例如 "/demo/ui/*" */
  180. "route": "/demo/ui/*",
  181. /* api描述,静态文件描述 */
  182. "apiName": "demo站点静态文件",
  183. /* 静态文件路径。可为相对路径或绝对路径。若为空或空字符串则默认为入口程序所在目录。demo:"wwwroot/demo" */
  184. "rootPath": "wwwroot/demo",
  185. /* 静态文件类型映射配置的文件路径。可为相对路径或绝对路径。例如"contentTypeMap.json"。若不指定(或指定的文件不存在)则不指定文件类型映射配置 */
  186. "contentTypeMapFile": "contentTypeMap.json",
  187. /* 回应静态文件时额外添加的http回应头。可不指定。 */
  188. "responseHeaders": {
  189. //设置浏览器静态文件缓存3600秒
  190. "Cache-Control": "public,max-age=3600"
  191. }
  192. }
  193. ],
  194. /* 默认站点名称,可多个,可不指定 */
  195. //"apiStationNames": [ "demo" ],
  196. /* Api加载器配置 */
  197. "//ApiLoaders": [
  198. {
  199. /* 在此Assembly中查找api加载器(如 Sers.Core.dll 、Sers.NetcoreLoader.dll 、 Sers.Serslot.dll ) */
  200. //"loader_assemblyFile": "Sers.Core.dll",
  201. /* 加载器的类名,可为 Sers.SersLoader.ApiLoader 、 Sers.NetcoreLoader.ApiLoader、 Sers.Serslot.ApiLoader 等。若不指定则默认为"Sers.SersLoader.ApiLoader" */
  202. //"loader_className": "Sers.SersLoader.ApiLoader",
  203. //(通过反射从此包中获取要加载的api)
  204. /* 在此Assembly中查找服务(如 Did.SersLoader.Demo.dll)(assembly、assemblyFile、assemblyName 指定任一即可) */
  205. "assemblyFile": "Did.SersLoader.Demo.dll",
  206. /* 在此Assembly中查找服务(如 Did.SersLoader.Demo)(assembly、assemblyFile、assemblyName 指定任一即可) */
  207. //"assemblyName": "Did.SersLoader.Demo",
  208. /* 强制指定ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  209. //"apiStationName_Force": "",
  210. /* ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  211. "apiStationName": "demo"
  212. /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
  213. //"routePrefix_Force": "",
  214. /* 路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix ) */
  215. //"routePrefix": ""
  216. }
  217. ],
  218. /* 调用Api时的自定义Scope对象。可不指定。事件顺序为 OnCreateScope -> BeforeCallApi -> OnDispose */
  219. "//OnCreateScope": [
  220. {
  221. //ApiTrace publisher(推送ApiTrace数据到ApiTrace.Collector)
  222. /* 在此Assembly中加载类 */
  223. "assemblyFile": "Sers.Core.dll",
  224. /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.ApiScope.IApiScopeEvent */
  225. "className": "Sers.Core.Module.Api.LocalApi.ApiTrace.ApiTracePublisher",
  226. /* 搜集器名称(根据此名称推送到对应的搜集器,搜集器在ApiTrace.Collector中配置),若不指定则不加载 */
  227. "collectorName": "default"
  228. }
  229. ],
  230. /* 调用api前的事件,可不指定。事件顺序为 OnCreateScope -> BeforeCallApi -> OnDispose */
  231. "//BeforeCallApi": [
  232. {
  233. /* 在此Assembly中加载类 */
  234. "assemblyFile": "Sers.Core.dll",
  235. /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.BeforeCallApi.IBeforeCallApi */
  236. "className": "Bearer",
  237. //Bearer: 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  238. /* 验证at接口的地址 */
  239. "api_verifyAt": "/AuthCenter/account/verifyAt",
  240. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  241. "api_httpMethod": "POST"
  242. },
  243. {
  244. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  245. "className": "AccountInCookie",
  246. "account": [
  247. {
  248. "userToken": "admin_123456",
  249. //"CallerSource": "Internal",
  250. "userInfo": {
  251. "name": "超级管理员",
  252. "入口": "Gover网关"
  253. }
  254. }
  255. ]
  256. }
  257. ]
  258. },
  259. /* ServiceStation配置,可不指定 */
  260. "ServiceStation": {
  261. /* 自动上报cpu Usage。不指定则不上报 */
  262. "//UsageReporter": {
  263. /* 上报时间间隔(单位:秒) */
  264. "intervalSecond": 2
  265. },
  266. /* serviceStation站点信息 */
  267. "serviceStationInfo": {
  268. /* 服务站点名称 */
  269. "serviceStationName": "ServiceCenter",
  270. /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
  271. //"stationVersion": "2.1.1",
  272. /* [json]服务站点额外信息,可不指定 */
  273. "info": null
  274. }
  275. },
  276. /* ServiceCenter 配置,可不指定 */
  277. "ServiceCenter": {
  278. /* 是否 输出Api注册事件到(Info)Log文件。默认:true */
  279. "ApiRegistEvent_Print": true,
  280. /* api路由管理方式,可不指定。可为:"RESTful","IgnoreHttpMethod"。若不指定或未指定有效值,则默认为"RESTful" */
  281. //"ApiRouteType": "IgnoreHttpMethod",
  282. //调用api前的事件,可不指定
  283. "//BeforeCallApi": [
  284. {
  285. /* 在此Assembly中加载类 */
  286. "assemblyFile": "Sers.Core.dll",
  287. /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.BeforeCallApi.IBeforeCallApi */
  288. "className": "Bearer",
  289. //Bearer: 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  290. /* 验证at接口的地址 */
  291. "api_verifyAt": "/AuthCenter/account/verifyAt",
  292. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  293. "api_httpMethod": "POST"
  294. },
  295. {
  296. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  297. //"className": "AccountInCookie",
  298. "account": [
  299. {
  300. "userToken": "admin_123456",
  301. //"CallerSource": "Internal",
  302. "userInfo": {
  303. "name": "超级管理员",
  304. "入口": "Gover网关"
  305. }
  306. }
  307. ]
  308. }
  309. ]
  310. },
  311. /* 动态加载的App事件 */
  312. "AppEvent": [
  313. {
  314. //ApiTrace publisher(推送ApiTrace数据到ApiTrace.Collector)
  315. /* 在此Assembly中加载类 */
  316. "assemblyFile": "Sers.Gover.dll",
  317. /* 动态加载的类名,必须继承接口 Sers.Core.Module.App.AppEvent.IAppEvent */
  318. //"className": "Sers.Gover.Base.AppEvent.ApiTracePublisher",
  319. /* 搜集器名称(根据此名称推送到对应的搜集器,搜集器在ApiTrace.Collector中配置),若不指定则不加载 */
  320. "collectorName": "default"
  321. }
  322. ],
  323. /* ApiTrace 搜集器配置,可不指定 */
  324. "ApiTrace": {
  325. "Collector": [
  326. { //搜集ApiTrace到 Log/{yyyy-MM}/[{yyyy-MM-dd}]ApiTrace.txt文件
  327. /* 搜集器名称(ApiTrace推送端根据此名称推送到对应的搜集器),若不指定则不加载 */
  328. "collectorName": "default",
  329. /* 在此Assembly中加载类 */
  330. "assemblyFile": "Sers.Core.dll",
  331. /* 动态加载的类名,必须继承接口 Sers.Core.Module.ApiTrace.Collector.IApiTraceCollector */
  332. //"className": "Sers.Core.Module.ApiTrace.Collector.TxtCollector", //亦可为TxtCollector
  333. "tags": {
  334. // 可为 requestRpc requestData responseRpc responseData
  335. "route": "{{requestRpc.route}}",
  336. //"{{requestRpc.route}}": "route",
  337. "url": "{{requestRpc.http.url}}",
  338. "method": "{{requestRpc.http.method}}",
  339. "requestRpc": "{{requestRpc}}",
  340. "requestData": "{{requestData}}",
  341. "responseRpc": "{{responseRpc}}",
  342. "responseState": "{{responseRpc.http.headers.responseState}}",
  343. //"responseError_Base64": "{{responseRpc.http.headers.responseError_Base64}}"
  344. "responseData": "{{responseData}}",
  345. "responseData.error": "{{responseData.error}}"
  346. }
  347. },
  348. { //搜集ApiTrace到 splunk
  349. /* 搜集器名称(ApiTrace推送端根据此名称推送到对应的搜集器),若不指定则不加载 */
  350. "collectorName": "default",
  351. /* 在此Assembly中加载类 */
  352. "assemblyFile": "Sers.Core.dll",
  353. /* 动态加载的类名,必须继承接口 Sers.Core.Module.ApiTrace.Collector.IApiTraceCollector */
  354. //"className": "Sers.Core.Module.ApiTrace.Collector.SplunkCollector",
  355. "client": {
  356. "url": "http://192.168.20.20:8088/services/collector",
  357. "authToken": "xxxxx",
  358. //若指定则在指定时间间隔统一推送数据,若不指定则立即推送。单位:ms
  359. "//intervalMs": 2000
  360. },
  361. "//message": {
  362. "index": "dev",
  363. "host": "192.168.20.20:8088",
  364. "source": "http:sers",
  365. "sourcetype": "sers-ApiTrace"
  366. },
  367. //custome object
  368. "//appInfo": {
  369. "namespace": "sers.cloud",
  370. "appName": "mc",
  371. "moduleName": "ServiceCenter"
  372. //,"...": {}
  373. },
  374. "//tags": {
  375. // 可为 requestRpc requestData responseRpc responseData
  376. "route": "{{requestRpc.route}}",
  377. //"{{requestRpc.route}}": "route",
  378. "url": "{{requestRpc.http.url}}",
  379. "method": "{{requestRpc.http.method}}",
  380. "requestRpc": "{{requestRpc}}",
  381. "requestData": "{{requestData}}",
  382. "responseRpc": "{{responseRpc}}",
  383. "responseState": "{{responseRpc.http.headers.responseState}}",
  384. //"responseError_Base64": "{{responseRpc.http.headers.responseError_Base64}}"
  385. "responseData": "{{responseData}}",
  386. "responseData.error": "{{responseData.error}}"
  387. }
  388. },
  389. { //搜集ApiTrace到Zipkin链路追踪
  390. /* 搜集器名称(ApiTrace推送端根据此名称推送到对应的搜集器),若不指定则不加载 */
  391. "collectorName": "Zipkin",
  392. /* 在此Assembly中加载类 */
  393. "assemblyFile": "Sers.ApiTrace.Collector.Zipkin.dll",
  394. /* 动态加载的类名,必须继承接口 Sers.Core.Module.ApiTrace.Collector.IApiTraceCollector */
  395. //"className": "Sers.ApiTrace.Collector.Zipkin.ZipKinCollector",
  396. /* 配置 */
  397. "SamplingRate": "1.0",
  398. "zipkinCollectorUrl": "http://sers.cloud:9411",
  399. /* 若不指定则默认为ServiceCenter */
  400. "rpcName": "ServiceCenter",
  401. "tags": {
  402. // 可为 requestRpc requestData responseRpc responseData
  403. "traceName": "demoTrace",
  404. "route": "{{requestRpc.route}}",
  405. "{{requestRpc.route}}": "route",
  406. "url": "{{requestRpc.http.url}}",
  407. "method": "{{requestRpc.http.method}}",
  408. "requestRpc": "{{requestRpc}}",
  409. //"requestData": "{{requestData}}",
  410. "responseRpc": "{{responseRpc}}",
  411. "responseState": "{{responseRpc.http.headers.responseState}}",
  412. "responseError_Base64": "{{responseRpc.http.headers.responseError_Base64}}"
  413. //"responseData": "{{responseData}}",
  414. //"responseData.error": "{{responseData.error}}"
  415. }
  416. }
  417. ]
  418. },
  419. /* 网关配置。若不指定,则不开启网关服务 */
  420. "Gateway": {
  421. /* Rpc配置,可不指定 */
  422. "Rpc": {
  423. /* 网关转发的请求中的rpc 信息中的 CallerSource。(暗指调用来源,默认"OutSide") */
  424. //"CallerSource": "OutSide"
  425. },
  426. "WebHost": {
  427. /* url,可多个 */
  428. "urls": [ "http://*:4580" ],
  429. /* https证书配置,可不指定。若urls中指定了https协议,请在此指定对应的https证书 */
  430. "//certificates": [
  431. {
  432. "filePath": "data/serset-com-iis-0923120142.pfx",
  433. "password": "password"
  434. }
  435. ],
  436. /* 重定向所有的http请求到https。若不指定则不重定向 */
  437. "//httpsRedirection": {
  438. /* 重定向的地址。若不指定,则使用发起请求的host */
  439. "host": "serset.com",
  440. /* 重定向的端口号。若不指定,则使用发起请求的port */
  441. "port": 443,
  442. /* The status code used for the redirect response. The default is 307. */
  443. "statusCode": 307
  444. },
  445. /* 是否允许跨域访问,默认true */
  446. "allowAnyOrigin": true,
  447. /* 把请求的ip地址、端口号复制到请求头中的前缀。若不指定则不复制。 */
  448. "prefixOfCopyIpToHeader": "Sers-Gateway-",
  449. /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset */
  450. "//ResponseDefaultContentType": "application/json; charset=UTF-8",
  451. /* 映射静态文件。若不指定则不映射静态文件 */
  452. "staticFiles": {
  453. /* 请求路径(可不指定)。demo:"/file/static"。The relative request path that maps to static resources */
  454. //"requestPath": "/file",
  455. /* 静态文件路径。可为相对路径或绝对路径。若为空或空字符串则为默认路径(wwwroot)。demo:"wwwroot/demo" */
  456. //"rootPath": "wwwroot",
  457. /* 默认页面(可不指定)。An ordered list of file names to select by default. List length and ordering may affect performance */
  458. "defaultFileNames": [ "index.html" ],
  459. /* 是否可浏览目录(default false)。Enables directory browsing */
  460. //"useDirectoryBrowser": false,
  461. /* 静态文件类型映射配置的文件路径。可为相对路径或绝对路径。例如"contentTypeMap.json"。若不指定(或指定的文件不存在)则不指定文件类型映射配置 */
  462. "contentTypeMapFile": "contentTypeMap.json",
  463. /* 回应静态文件时额外添加的http回应头。可不指定。 */
  464. "responseHeaders": {
  465. //设置浏览器静态文件缓存3600秒
  466. "Cache-Control": "public,max-age=3600"
  467. }
  468. }
  469. },
  470. //调用api前的事件,可不指定
  471. "BeforeCallApi": [
  472. {
  473. /* 在此Assembly中加载类 */
  474. "assemblyFile": "Sers.Core.dll",
  475. /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.BeforeCallApi.IBeforeCallApi */
  476. //"className": "Bearer",
  477. //Bearer: 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  478. /* 验证at接口的地址 */
  479. "api_verifyAt": "/AuthCenter/account/verifyAt",
  480. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  481. "api_httpMethod": "POST"
  482. },
  483. {
  484. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  485. "className": "AccountInCookie",
  486. "account": [
  487. {
  488. "userToken": "admin_123456",
  489. "CallerSource": "Internal",
  490. "userInfo": {
  491. "name": "Gover管理员",
  492. "入口": "Gover网关"
  493. }
  494. }
  495. ]
  496. }
  497. ],
  498. /* 服务限流配置,可不指定 */
  499. "rateLimit": [
  500. {
  501. /* 服务限流key,标识一个限流服务,必须唯一 */
  502. "rateLimitKey": "rate",
  503. /* 固定时间窗口限流。在单位时间(msInterval)内限制最大请求数量为reqLimit。超出数量的请求将被拒绝 */
  504. "rateLimitType": "FixedWindow",
  505. /* 单位时间内最大请求数量(个)*/
  506. "reqLimit": 100000,
  507. /* 单位时间长度(单位:ms)*/
  508. "msInterval": 1000
  509. }
  510. ]
  511. }
  512. },
  513. /* Vit工具配置,可不指定 */
  514. "Vit": {
  515. /* 日志配置,可不指定 */
  516. "Logger": {
  517. /* print the log to Log/*.txt default:true */
  518. "PrintToTxt": true,
  519. /* print the log to console. default:true */
  520. "PrintToConsole": true,
  521. /* [optional]collector to send log to */
  522. "//Collector": [
  523. {
  524. /* 在此Assembly中加载类 */
  525. "assemblyFile": "Vit.Core.dll",
  526. /* 动态加载的类名,必须继承接口 Vit.Core.Module.Log.LogCollector.ILogCollector */
  527. "className": "Vit.Core.Module.Log.LogCollector.Splunk.SplunkCollector",
  528. "client": {
  529. "url": "http://192.168.20.20:8088/services/collector",
  530. "authToken": "xxxxx",
  531. //若指定则在指定时间间隔统一推送数据,若不指定则立即推送。单位:ms
  532. "//intervalMs": 2000
  533. },
  534. "//message": {
  535. "index": "dev",
  536. "host": "192.168.20.20:8088",
  537. "source": "http:mc",
  538. "sourcetype": "httpevent"
  539. },
  540. //custome object
  541. "//appInfo": {
  542. "namespace": "sers.cloud",
  543. "appName": "mc",
  544. "moduleName": "ServiceCenter"
  545. //,"...": {}
  546. }
  547. }
  548. ]
  549. },
  550. /* 序列化配置,可不指定 */
  551. "Serialization": {
  552. /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
  553. "Encoding": "UTF8",
  554. /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
  555. "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
  556. },
  557. "//Kestrel": {
  558. /* (int64) the maximum allowed size of any request body in bytes. When set to null, the maximum request body size is unlimited. */
  559. "MaxRequestBodySize": 2000000000,
  560. /* (int32) A limit on the length of individual form values. Forms containing values that exceed this limit will throw an System.IO.InvalidDataException when parsed. */
  561. "ValueLengthLimit": 2000000000,
  562. /* (int64) A limit for the length of each multipart body. Forms sections that exceed this limit will throw an System.IO.InvalidDataException when parsed. */
  563. "MultipartBodyLengthLimit": 2000000000
  564. }
  565. },
  566. /* 若不指定,则不输出aspnet日志到控制台输出 */
  567. "Logging": {
  568. "LogLevel": {
  569. "Default": "Warning"
  570. }
  571. }
  572. }