appsettings.json 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {
  2. "Logging": {
  3. "LogLevel": {
  4. "Default": "Warning"
  5. }
  6. },
  7. "Sers": {
  8. /* 通讯层配置 */
  9. "CL": {
  10. /* one conn is one channel.can be multiable */
  11. "Client": [
  12. {
  13. // Socket.Iocp
  14. /* (x.1) type - Iocp */
  15. /* the class of builder in assemblyFile */
  16. "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
  17. /* (x.2) conn config */
  18. /* 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */
  19. "host": "127.0.0.1",
  20. /* 服务端 监听端口号。例如: 4501 */
  21. "port": 4501,
  22. //HeartBeat
  23. /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
  24. "heartBeatIntervalMs": 10000,
  25. /* 心跳检测超时时间(单位ms,默认30000) */
  26. "heartBeatTimeoutMs": 30000,
  27. /* 心跳检测失败重试次数(单位次,默认10) */
  28. "heartBeatRetryCount": 10,
  29. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  30. "secretKey": "SersCL"
  31. }
  32. ]
  33. },
  34. /* ServiceStation配置,可不指定 */
  35. "ServiceStation": {
  36. /* serviceStation站点信息 */
  37. "serviceStationInfo": {
  38. "serviceStationName": "Gateway"
  39. }
  40. },
  41. /* 网关配置(同目录下可以指定mappings.json文件) */
  42. "Gateway": {
  43. /* Rpc配置,可不指定 */
  44. "Rpc": {
  45. /* 网关转发的请求中的rpc 信息中的 CallerSource。(暗指调用来源,默认"OutSide") */
  46. //"CallerSource": "OutSide"
  47. },
  48. "WebHost": {
  49. /* url,可多个 */
  50. "urls": [ "http://*:4582" ],
  51. /* http回应中的默认Content-Type。若不指定则默认为 "application/json; charset="+Serialization.Instance.charset */
  52. "//ResponseDefaultContentType": "application/json; charset=UTF-8",
  53. /* 静态文件路径。可为相对路径或绝对路径。若为空字符串则默认为当前目录下的wwwroot文件夹。若不指定(null)则不映射静态文件。 */
  54. "//wwwroot": ""
  55. },
  56. //调用api前的事件,可不指定
  57. "BeforeCallApi": [
  58. {
  59. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  60. //"className": "Bearer",
  61. /* 验证at接口的地址 */
  62. "api_verifyAt": "/AuthCenter/account/verifyAt",
  63. /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
  64. "api_httpMethod": "POST"
  65. },
  66. {
  67. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  68. //"className": "AccountInCookie",
  69. "account": [
  70. {
  71. "userToken": "admin_123456",
  72. //"CallerSource": "Internal",
  73. "userInfo": {
  74. "name": "超级管理员",
  75. "入口": "Gover网关"
  76. }
  77. }
  78. ]
  79. }
  80. ],
  81. /* 服务限流配置,可不指定 */
  82. "rateLimit": [
  83. {
  84. /* 服务限流key,标识一个限流服务,必须唯一 */
  85. "rateLimitKey": "rate",
  86. /* 固定时间窗口限流。在单位时间(msInterval)内限制最大请求数量为reqLimit。超出数量的请求将被拒绝 */
  87. "rateLimitType": "FixedWindow",
  88. /* 单位时间内最大请求数量(个)*/
  89. "reqLimit": 100000,
  90. /* 单位时间长度(单位:ms)*/
  91. "msInterval": 1000
  92. }
  93. ]
  94. }
  95. },
  96. /* Vit工具配置,可不指定 */
  97. "Vit": {
  98. /* 日志配置,可不指定 */
  99. "Logger": {
  100. /* print the log to console. default:false */
  101. "PrintToConsole": true
  102. },
  103. /* 序列化配置,可不指定 */
  104. "Serialization": {
  105. /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
  106. "Encoding": "UTF8",
  107. /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
  108. "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
  109. },
  110. "Kestrel": {
  111. /* the maximum allowed size of any request body in bytes. When set to null, the maximum request body size is unlimited. */
  112. "//MaxRequestBodySize": 100000000
  113. }
  114. }
  115. }