appsettings.json 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. {
  2. /* Sers微服务配置 */
  3. "Sers": {
  4. /* 通讯层配置 */
  5. "CL": {
  6. /* 共用配置,子项共用,覆写子项未指定的配置 */
  7. "Config": {
  8. /* 请求超时时间(单位ms,默认60000) */
  9. "requestTimeoutMs": 60000,
  10. /* 后台处理消息的线程个数(单位个,默认2) */
  11. "workThreadCount": 2,
  12. //HeartBeat
  13. /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
  14. "heartBeatIntervalMs": 10000,
  15. /* 心跳检测超时时间(单位ms,默认30000) */
  16. "heartBeatTimeoutMs": 30000,
  17. /* 心跳检测失败重试次数(单位次,默认10) */
  18. "heartBeatRetryCount": 10,
  19. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  20. "secretKey": "SersCL"
  21. },
  22. /* one conn is one channel.can be multiable */
  23. "Client": [
  24. {
  25. // Socket.Iocp
  26. /* (x.1) type - Iocp */
  27. /* 在此Assembly中查找builder */
  28. //"assemblyFile": "Sers.CL.Socket.Iocp.dll",
  29. /* the class of builder in assemblyFile */
  30. "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
  31. /* (x.2) conn config */
  32. /* 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */
  33. "host": "127.0.0.1",
  34. /* 服务端 监听端口号。例如: 4501 */
  35. "port": 4501
  36. },
  37. {
  38. // Socket.ThreadWait
  39. /* (x.1) type - ThreadWait */
  40. /* the class of builder in assemblyFile */
  41. //"className": "Sers.CL.Socket.ThreadWait.OrganizeClientBuilder",
  42. /* (x.2) config */
  43. /* 服务端 host地址。例如: "127.0.0.1"、"sersms.com" */
  44. "host": "127.0.0.1",
  45. /* 服务端 监听端口号。例如: 4501 */
  46. "port": 4501
  47. },
  48. {
  49. // Zmq.ThreadWait
  50. /* (x.1) type */
  51. /* 在此Assembly中查找Builder */
  52. "assemblyFile": "Sers.CL.ClrZmq.ThreadWait.dll",
  53. /* the class of Builder in assemblyFile */
  54. //"className": "Sers.CL.ClrZmq.ThreadWait.OrganizeClientBuilder",
  55. /* (x.2) config */
  56. /* 地址。例如: "tcp://127.0.0.1:4502" 、 "ipc://4502" */
  57. "endpoint": "tcp://127.0.0.1:4502"
  58. },
  59. {
  60. // WebSocket
  61. /* (x.1) type - WebSocket */
  62. /* 在此Assembly中查找builder */
  63. "assemblyFile": "Sers.CL.WebSocket.dll",
  64. /* the class of builder in assemblyFile */
  65. //"className": "Sers.CL.WebSocket.OrganizeClientBuilder",
  66. /* (x.2) conn config */
  67. /* 服务端地址(默认为 "ws://127.0.0.1:4503") */
  68. "host": "ws://127.0.0.1:4503"
  69. },
  70. {
  71. // Zmq.FullDuplex
  72. /* (x.1) type */
  73. /* 在此Assembly中查找Builder */
  74. "assemblyFile": "Sers.CL.Zmq.FullDuplex.dll",
  75. /* the class of Builder in assemblyFile */
  76. //"className": "Sers.CL.Zmq.FullDuplex.OrganizeClientBuilder",
  77. /* (x.2) config */
  78. /* 地址。例如: "tcp://127.0.0.1:4504" 、 "ipc://4504" */
  79. "endpoint": "tcp://127.0.0.1:4504"
  80. },
  81. {
  82. // Ipc.SharedMemory
  83. /* (x.1) type - Ipc.SharedMemory */
  84. /* 在此Assembly中查找Builder */
  85. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  86. /* the class of Builder in assemblyFile */
  87. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeClientBuilder",
  88. /* (x.2) config */
  89. /* 共享内存名称。例如: "ipcTest" */
  90. "name": "ipcForStationDemo"
  91. }
  92. ]
  93. },
  94. /* LocalApiService 配置,可不指定 */
  95. "LocalApiService": {
  96. /* 后台服务的线程个数(单位个,默认0,代表不开启服务)*/
  97. "workThreadCount": 4,
  98. /* 超时时间,若不指定则后台任务永不超时。(主动关闭超过此时间的任务,实际任务强制关闭的时间会在1倍超时时间到2倍超时时间内)。单位:ms。*/
  99. "timeout_ms": 10000,
  100. /* 是否 输出本地Api的调用信息到(ApiTrace)Log文件。默认:false */
  101. "PrintTrace": false,
  102. /* 静态文件映射器。映射站点静态文件,可多个,可不指定 */
  103. "StaticFileMap": [
  104. {
  105. /* api路由前缀,例如 "/demo/ui/*" */
  106. "route": "/demo/ui/*",
  107. /* api描述,静态文件描述 */
  108. "apiName": "demo站点静态文件",
  109. /* 静态文件路径。可为相对路径或绝对路径。若未指定存在的文件夹则默认为当前目录下的wwwroot文件夹。demo:"wwwroot/demo" */
  110. "staticFileDirectory": "wwwroot/demo",
  111. /* 额外静态文件类型映射配置的文件路径(mappings.json),例如"wwwroot/mappings.json"。若不指定(或指定的文件不存在)则不添加额外文件类型映射配置 */
  112. "ContentTypeMapFile": "mappings.json"
  113. }
  114. ],
  115. /* 默认站点名称,可多个,可不指定 */
  116. "apiStationNames": [ "demo" ],
  117. /* Api加载器配置 */
  118. "//ApiLoaders": [
  119. {
  120. /* 加载器的类名,可为 Sers.ApiLoader.Ss.ApiLoader 、 Sers.ApiLoader.WebApi21.ApiLoader 等。若不指定则默认为"Sers.ApiLoader.Ss.ApiLoader" */
  121. //"loader_className": "Sers.ApiLoader.WebApi21.ApiLoader",
  122. /* 在此Assembly中查找服务(如 Sers.Core.Station.dll 、Sers.ApiLoader.WebApi21.dll) */
  123. //"loader_assemblyFile": "Sers.ApiLoader.WebApi21.dll",
  124. //(通过反射从此包中获取要加载的api)
  125. /* 在此Assembly中查找服务(如 App.StationDemo.Station.dll)(assembly、assemblyFile、assemblyName 指定任一即可) */
  126. "assemblyFile": "App.StationDemo.Station.dll",
  127. /* 在此Assembly中查找服务(如 App.StationDemo.Station)(assembly、assemblyFile、assemblyName 指定任一即可) */
  128. //"assemblyName": "App.StationDemo.Station",
  129. /* 强制指定ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  130. //"apiStationName_Force": "",
  131. /* ApiStation名称。可不指定。(优先级从高到低: apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
  132. "apiStationName": "demo"
  133. /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
  134. //"routePrefix_Force": "",
  135. /* 路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低: routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix ) */
  136. //"routePrefix": ""
  137. }
  138. ],
  139. //调用api前的事件,可不指定
  140. "//BeforeCallApi": [
  141. {
  142. //Bearer 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
  143. "className": "Bearer",
  144. /* 验证at接口的地址 */
  145. "api_verifyAt": "/AuthCenter/account/verifyAt"
  146. },
  147. {
  148. //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
  149. "className": "AccountInCookie",
  150. "account": [
  151. {
  152. "userToken": "admin_123456",
  153. //"CallerSource": "Internal",
  154. "userInfo": {
  155. "name": "超级管理员",
  156. "入口": "Gover网关"
  157. }
  158. }
  159. ]
  160. }
  161. ]
  162. },
  163. /* ServiceStation配置,可不指定 */
  164. "ServiceStation": {
  165. /* 自动上报cpu Usage。不指定则不上报 */
  166. "//UsageReporter": {
  167. /* 上报时间间隔(单位:秒) */
  168. "intervalSecond": 2
  169. },
  170. /* 服务中心注册配置。在向服务中心注册站点前 是否打印(Logger.Info)请求参数。默认:false */
  171. "StationRegist_PrintRegistArg": false,
  172. /* serviceStation站点信息,可不指定 */
  173. "serviceStationInfo": {
  174. /* 服务站点名称 */
  175. "serviceStationName": "demo",
  176. /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
  177. //"stationVersion": "1.1.9.0",
  178. /* [json]服务站点额外信息,可不指定 */
  179. "info": null
  180. }
  181. }
  182. },
  183. "Demo": {
  184. /* 静态文件路径。可为相对路径或绝对路径。若未指定存在的文件夹则默认为当前目录下的wwwroot文件夹。 */
  185. "wwwroot": "wwwroot\\demo"
  186. },
  187. /* Vit工具配置,可不指定 */
  188. "Vit": {
  189. /* 日志配置,可不指定 */
  190. "Logger": {
  191. /* print the log to console. default:false */
  192. "PrintToConsole": true
  193. },
  194. /* 序列化配置,可不指定 */
  195. "Serialization": {
  196. /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
  197. "Encoding": "UTF8",
  198. /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
  199. "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
  200. }
  201. }
  202. }