appsettings.json 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. /* 数据传输 加密协议,可多个,可不指定 */
  22. "//security": [
  23. {
  24. // SampleSecurity
  25. /* 在此Assembly中查找security */
  26. "assemblyFile": "Sers.Core.dll",
  27. /* the class of security in assemblyFile. 必须继承接口 Sers.Core.Util.StreamSecurity.ISecurity */
  28. "className": "Sers.Core.Util.StreamSecurity.Security.SampleSecurity",
  29. /* (x.2) config */
  30. /* 加密密钥 */
  31. "secret": "security"
  32. },
  33. {
  34. // SampleSecurity
  35. /* 若不指定assemblyFile和className 则默认为Sers.Core.Util.StreamSecurity.Security.SampleSecurity */
  36. "secret": "Two layer encryption"
  37. }
  38. ],
  39. /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
  40. "secretKey": "SersCL"
  41. },
  42. /* one conn is one channel.can be multiable */
  43. "Client": [
  44. {
  45. // Ipc.NamedPipe
  46. /* (x.1) type */
  47. /* 在此Assembly中查找builder */
  48. "assemblyFile": "Sers.CL.Ipc.NamedPipe.dll",
  49. /* the class of builder in assemblyFile */
  50. //"className": "Sers.CL.Ipc.NamedPipe.OrganizeClientBuilder",
  51. /* (x.2) config */
  52. // 命名管道只支持本机或局域网。
  53. /* 服务端机器名或者ip地址(如 103.23.23.23 、win10f),默认 "." */
  54. "serverName": ".",
  55. /* 命名管道名称。例如: "Sers.CL.Ipc" */
  56. "pipeName": "Sers.CL.Ipc.4501"
  57. },
  58. {
  59. // Socket.Iocp
  60. /* (x.1) type - Iocp */
  61. /* 在此Assembly中查找builder */
  62. //"assemblyFile": "Sers.CL.Socket.Iocp.dll",
  63. /* the class of builder in assemblyFile */
  64. "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
  65. /* 通信模式(默认值:Simple)。可为 Simple、Timer、ThreadWait */
  66. "mode": "ThreadWait",
  67. /* (x.2) config */
  68. /* 服务端 host地址。例如: "127.0.0.1"、"sers.cloud" */
  69. "host": "127.0.0.1",
  70. /* 服务端 监听端口号。例如: 4501 */
  71. "port": 4501
  72. },
  73. {
  74. // Socket.ThreadWait
  75. /* (x.1) type - ThreadWait */
  76. /* the class of builder in assemblyFile */
  77. //"className": "Sers.CL.Socket.ThreadWait.OrganizeClientBuilder",
  78. /* (x.2) config */
  79. /* 服务端 host地址。例如: "127.0.0.1"、"sers.cloud" */
  80. "host": "127.0.0.1",
  81. /* 服务端 监听端口号。例如: 4501 */
  82. "port": 4501
  83. },
  84. {
  85. // Zmq.ThreadWait
  86. /* (x.1) type */
  87. /* 在此Assembly中查找builder */
  88. "assemblyFile": "Sers.CL.ClrZmq.ThreadWait.dll",
  89. /* the class of builder in assemblyFile */
  90. //"className": "Sers.CL.ClrZmq.ThreadWait.OrganizeClientBuilder",
  91. /* (x.2) config */
  92. /* 地址。例如: "tcp://127.0.0.1:4502" 、 "ipc://4502" */
  93. "endpoint": "tcp://127.0.0.1:4502"
  94. },
  95. {
  96. // WebSocket
  97. /* (x.1) type - WebSocket */
  98. /* 在此Assembly中查找builder */
  99. "assemblyFile": "Sers.CL.WebSocket.dll",
  100. /* the class of builder in assemblyFile */
  101. //"className": "Sers.CL.WebSocket.OrganizeClientBuilder",
  102. /* (x.2) config */
  103. /* 服务端地址(默认为 "ws://127.0.0.1:4503") */
  104. "host": "ws://127.0.0.1:4503"
  105. },
  106. {
  107. // Zmq.FullDuplex
  108. /* (x.1) type */
  109. /* 在此Assembly中查找builder */
  110. "assemblyFile": "Sers.CL.Zmq.FullDuplex.dll",
  111. /* the class of builder in assemblyFile */
  112. //"className": "Sers.CL.Zmq.FullDuplex.OrganizeClientBuilder",
  113. /* (x.2) config */
  114. /* 地址。例如: "tcp://127.0.0.1:4504" 、 "ipc://4504" */
  115. "endpoint": "tcp://127.0.0.1:4504"
  116. },
  117. {
  118. // Ipc.SharedMemory
  119. /* (x.1) type - Ipc.SharedMemory */
  120. /* 在此Assembly中查找builder */
  121. "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
  122. /* the class of builder in assemblyFile */
  123. //"className": "Sers.CL.Ipc.SharedMemory.OrganizeClientBuilder",
  124. /* (x.2) config */
  125. /* 共享内存名称。例如: "ipcTest" */
  126. "name": "ipcForRobot"
  127. }
  128. ]
  129. },
  130. // RpcData序列化模式。可不指定。默认为Text。
  131. // 可为 Newtonsoft、Text、BytePointor。
  132. // 效率依次递增。BytePointor 序列化为二进制数据而不是json字符串。
  133. "RpcDataSerializeMode": "BytePointor",
  134. /* LocalApiService 配置,可不指定 */
  135. "LocalApiService": {
  136. "workThread": {
  137. // 模式,可为 LongThread(默认)、LongThread_TimeLimit、ManagedThread、ConsumerCascade
  138. "mode": "LongThread",
  139. /* 后台服务的线程个数(单位个,默认16)(0代表不开启服务) */
  140. "threadCount": 20,
  141. /* 最大线程数(包含常驻线程和临时线程),默认100。仅当mode为ManagedThread时有效 */
  142. "maxThreadCount": 100,
  143. /* 等待队列的最大长度(默认:100000)。仅当mode为LongThread_TimeLimit和ManagedThread时有效 */
  144. "pendingQueueLength": 100000,
  145. /* 超时时间(单位ms,默认300000),仅当mode为LongThread_TimeLimit、ManagedThread时有效 */
  146. "timeoutMs": 300000
  147. },
  148. /* 静态文件映射器。映射站点静态文件,可多个,可不指定 */
  149. "staticFiles": [
  150. {
  151. /* api路由前缀,例如 "/demo/ui/*" */
  152. "route": "/_robot_/*",
  153. /* api描述,静态文件描述 */
  154. "apiName": "robot站点静态文件",
  155. /* 静态文件路径。可为相对路径或绝对路径。若为空或空字符串则为默认路径(wwwroot)。demo:"wwwroot/demo" */
  156. "rootPath": "wwwroot/_robot_",
  157. /* 静态文件类型映射配置的文件路径。可为相对路径或绝对路径。例如"contentTypeMap.json"。若不指定(或指定的文件不存在)则不指定文件类型映射配置 */
  158. "contentTypeMapFile": "contentTypeMap.json",
  159. /* 回应静态文件时额外添加的http回应头。可不指定。 */
  160. "responseHeaders": {
  161. //设置浏览器静态文件缓存3600秒
  162. "Cache-Control": "public,max-age=3600"
  163. }
  164. }
  165. ]
  166. },
  167. /* ServiceStation配置,可不指定 */
  168. "ServiceStation": {
  169. /* serviceStation站点信息 */
  170. "serviceStationInfo": {
  171. "serviceStationName": "Robot"
  172. }
  173. }
  174. },
  175. /* Vit工具配置,可不指定 */
  176. "Vit": {
  177. /* 日志配置,可不指定 */
  178. "Logger": {
  179. /* print the log to Log/*.txt default:true */
  180. "PrintToTxt": true,
  181. /* print the log to console. default:false */
  182. "PrintToConsole": true
  183. }
  184. }
  185. }