appsettings.json 28 KB

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