lith 4 vuotta sitten
vanhempi
commit
eb61a26d47

+ 14 - 2
dotnet/Sers.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29503.13
+# Visual Studio 15
+VisualStudioVersion = 15.0.28306.52
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sers.Core", "Sers.Core", "{C3954FC1-88A0-4915-AF47-E0B75AAAA63A}"
 EndProject
@@ -159,6 +159,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gover.Apm.Zipkin", "Se
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.CL.Ipc.NamedPipe", "Sers\Sers.CL\Ipc\Sers.CL.Ipc.NamedPipe\Sers.CL.Ipc.NamedPipe.csproj", "{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netfx", "netfx", "{50CEB918-97FF-469D-99BD-F83FDF5C7841}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ServiceCenter", "ServiceCenter", "{60F78A07-296D-4F7B-8D32-D19B75B3284E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App.ServiceCenter.NetFx", "netfx\ServiceCenter\App.ServiceCenter.NetFx\App.ServiceCenter.NetFx.csproj", "{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -337,6 +343,10 @@ Global
 		{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -416,6 +426,8 @@ Global
 		{AF17FAEF-DBCC-4E5C-954D-BD4F60A016C1} = {97C34C06-AE79-4E1A-8D04-EB0107643302}
 		{DD0CB14B-D8E6-46EC-AE42-2B1215C1BBDD} = {AF17FAEF-DBCC-4E5C-954D-BD4F60A016C1}
 		{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D} = {ECEEABBB-DEA2-4CD4-99EA-3E048DB23219}
+		{60F78A07-296D-4F7B-8D32-D19B75B3284E} = {50CEB918-97FF-469D-99BD-F83FDF5C7841}
+		{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350} = {60F78A07-296D-4F7B-8D32-D19B75B3284E}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {C7DA16E3-9949-49FA-B0B4-F830636DE60F}

+ 103 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx.csproj

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{FA7A3CFB-13DE-44E9-B562-F26A0CBE6350}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>App.ServiceCenter.NetFx</RootNamespace>
+    <AssemblyName>App.ServiceCenter.NetFx</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Fleck, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Fleck.1.1.0\lib\net45\Fleck.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Microsoft.DotNet.PlatformAbstractions.2.0.0\lib\net45\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Microsoft.Extensions.DependencyModel.2.0.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.CL.Ipc.NamedPipe, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.CL.Ipc.NamedPipe.2.1.1.373\lib\netstandard2.0\Sers.CL.Ipc.NamedPipe.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.CL.Socket.Iocp, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.CL.Socket.Iocp.2.1.1.373\lib\netstandard2.0\Sers.CL.Socket.Iocp.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.CL.Socket.ThreadWait, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.CL.Socket.ThreadWait.2.1.1.373\lib\netstandard2.0\Sers.CL.Socket.ThreadWait.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.CL.WebSocket, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.CL.WebSocket.2.1.1.373\lib\netstandard2.0\Sers.CL.WebSocket.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.Core, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.Core.2.1.1.373\lib\netstandard2.0\Sers.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.Gover, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.Gover.2.1.1.373\lib\netstandard2.0\Sers.Gover.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.Hardware, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.Hardware.2.1.1.373\lib\netstandard2.0\Sers.Hardware.dll</HintPath>
+    </Reference>
+    <Reference Include="Sers.ServiceCenter, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Sers.ServiceCenter.2.1.1.373\lib\netstandard2.0\Sers.ServiceCenter.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Vit.Core, Version=2.1.1.373, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Vit.Core.2.1.1.373\lib\netstandard2.0\Vit.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <Content Include="appsettings.json">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+  </PropertyGroup>
+</Project>

+ 18 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/App.config

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+    </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 61 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/Program.cs

@@ -0,0 +1,61 @@
+using Newtonsoft.Json.Linq;
+//using Sers.Gateway;
+using Vit.Core.Module.Log;
+using Vit.Core.Util.ConfigurationManager;
+using Vit.Extensions;
+
+namespace App.ServiceCenter
+{
+    public class Program
+    {
+        public static void Main(string[] args)
+        {
+
+            //(x.1) Init
+            Sers.ServiceCenter.ServiceCenter.Init();
+
+
+            #region (x.2) 初始化扩展模块
+
+            #region (x.x.1)使用 Gover 服务治理 模块
+            Sers.ServiceCenter.ServiceCenter.Instance.UseGover();
+            #endregion
+
+
+            #region (x.x.2)加载 ServiceCenter ApiEvent BeforeCallApi
+            var BeforeCallApi = Sers.Core.Module.Api.ApiEvent.EventBuilder.LoadEvent_BeforeCallApi(ConfigurationManager.Instance.GetByPath<JArray>("Sers.ServiceCenter.BeforeCallApi"));
+            if (BeforeCallApi != null) Sers.ServiceCenter.ServiceCenter.Instance.apiCenterService.BeforeCallApi += BeforeCallApi;
+            #endregion
+
+            //(x.x.3)从配置文件(appsettings.json::Sers.LocalApiService.ApiLoaders ) 加载api加载器并加载api        
+            Sers.ServiceCenter.ServiceCenter.Instance.LoadApi();
+
+            //(x.x.4)加载系统Api
+            Sers.ServiceCenter.ServiceCenter.Instance.LoadSsApi(typeof(Sers.ServiceCenter.Controllers.ServiceStationController).Assembly);
+
+            #endregion
+
+
+            //(x.3) Start ServiceCenter
+            if (!Sers.ServiceCenter.ServiceCenter.Start()) return;
+
+
+            #region (x.4) Start gateway if needed
+            //try
+            //{
+            //    GatewayHelp.Bridge();
+            //}
+            //catch (System.Exception ex)
+            //{
+            //    Logger.Error(ex);
+            //    return;
+            //}
+            #endregion
+
+
+            //(x.5) RunAwait
+            Sers.ServiceCenter.ServiceCenter.RunAwait();
+
+        }
+    }
+}

+ 36 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("App.ServiceCenter.NetFx")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("App.ServiceCenter.NetFx")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("fa7a3cfb-13de-44e9-b562-f26a0cbe6350")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.1.1.373")]
+[assembly: AssemblyFileVersion("2.1.1.373")]

+ 429 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/appsettings.json

@@ -0,0 +1,429 @@
+{
+
+  "Sers": {
+    /* 通讯层配置 */
+    "CL": {
+      /* 共用配置,子项共用,覆写子项未指定的配置 */
+      "Config": {
+
+        /* 请求超时时间(单位ms,默认60000) */
+        "requestTimeoutMs": 60000,
+
+        /* 后台处理消息的线程个数(单位个,默认2) */
+        "workThreadCount": 8,
+
+        //HeartBeat
+        /* 心跳检测时间间隔(单位ms,默认10000,若指定为0则不进行心跳检测) */
+        "heartBeatIntervalMs": 10000,
+        /* 心跳检测超时时间(单位ms,默认30000) */
+        "heartBeatTimeoutMs": 30000,
+        /* 心跳检测失败重试次数(单位次,默认10) */
+        "heartBeatRetryCount": 10,
+     
+
+        /* 数据传输 加密协议,可多个,可不指定 */
+        "//security": [
+          {
+            // SampleSecurity
+            /* 在此Assembly中查找security */
+            "assemblyFile": "Sers.Core.dll",
+            /* the class of security in assemblyFile. 必须继承接口 Sers.Core.Util.StreamSecurity.ISecurity  */
+            "className": "Sers.Core.Util.StreamSecurity.Security.SampleSecurity",
+
+            /* (x.2) config */
+            /* 加密密钥 */
+            "secret": "security"
+          },
+          {
+            // SampleSecurity
+            /* 若不指定assemblyFile和className 则默认为Sers.Core.Util.StreamSecurity.Security.SampleSecurity */
+            "secret": "Two layer encryption"
+          }
+        ],
+
+
+        /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
+        "secretKey": "SersCL"
+
+      },
+      /* one conn is one channel.can be multiable */
+      "Server": [
+        {
+          //Ipc.NamedPipe
+          /* (x.1) type */
+          /* 在此Assembly中查找Builder */
+          "assemblyFile": "Sers.CL.Ipc.NamedPipe.dll",
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.Ipc.NamedPipe.OrganizeServerBuilder",
+
+
+          /* (x.2) config */
+          /* 命名管道名称。例如: "Sers.CL.Ipc" */
+          "pipeName": "Sers.CL.Ipc.4501"
+        },
+        {
+          // Socket.Iocp
+          /* (x.1) type - Iocp */
+          /* the class of Builder in assemblyFile  */
+          "className": "Sers.CL.Socket.Iocp.OrganizeServerBuilder",
+
+
+          /* (x.2) config */
+          /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sersms.com"。*/
+          //"host": "127.0.0.1",
+          /* 服务端 监听端口号。例如: 4501 */
+          "port": 4501
+        },
+        {
+          // Socket.ThreadWait
+          /* (x.1) type - Socket */
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.Socket.ThreadWait.OrganizeServerBuilder",
+
+
+          /* (x.2) config */
+          /* 服务端 监听地址。若不指定则监听所有网卡。例如: "127.0.0.1"、"sersms.com"。*/
+          //"host": "127.0.0.1",
+          /* 服务端 监听端口号。例如: 4501 */
+          "port": 4501
+        },
+
+        {
+          // Zmq.ThreadWait
+          /* (x.1) type */
+          /* 在此Assembly中查找Builder */
+          "assemblyFile": "Sers.CL.ClrZmq.ThreadWait.dll",
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.ClrZmq.ThreadWait.OrganizeServerBuilder",
+
+
+          /* (x.2) config */
+          /* 地址。例如: "tcp://*:4502" 、 "ipc://4502" */
+          "endpoint": "tcp://*:4502"
+        },
+
+        {
+          // WebSocket
+          /* (x.1) type - Iocp */
+          /* 在此Assembly中查找builder */
+          "assemblyFile": "Sers.CL.WebSocket.dll",
+          /* the class of builder in assemblyFile  */
+          //"className": "Sers.CL.WebSocket.OrganizeServerBuilder",
+
+          /* (x.2) config */
+          /* 服务端地址(默认为 "ws://0.0.0.0:4503") */
+          "host": "ws://0.0.0.0:4503"
+        },
+
+        {
+          // Zmq.FullDuplex
+          /* (x.1) type */
+          /* 在此Assembly中查找Builder */
+          "assemblyFile": "Sers.CL.Zmq.FullDuplex.dll",
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.Zmq.FullDuplex.OrganizeServerBuilder",
+
+          /* (x.2) config */
+          /* 地址。例如: "tcp://*:4504" 、 "ipc://4504" */
+          "endpoint": "tcp://*:4504"
+        },
+
+
+        {
+          //Ipc.SharedMemory
+          /* (x.1) type - Ipc.SharedMemory */
+          /* 在此Assembly中查找Builder */
+          "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
+
+
+          /* (x.2) config */
+          /* 共享内存名称。例如: "ipcTest" */
+          "name": "ipcForStationDemo",
+          /* 共享内存节点个数。例如: 64 */
+          "nodeCount": 128,
+          /* 共享内存节点大小。例如: 2048 */
+          "nodeBufferSize": 102400
+        },
+        {
+          /* (x.1) type - Ipc.SharedMemory */
+          /* 在此Assembly中查找Builder */
+          "assemblyFile": "Sers.CL.Ipc.SharedMemory.dll",
+          /* the class of Builder in assemblyFile  */
+          //"className": "Sers.CL.Ipc.SharedMemory.OrganizeServerBuilder",
+
+          /* (x.2) config */
+          /* 共享内存名称。例如: "ipcTest" */
+          "name": "ipcForRobot",
+          /* 共享内存节点个数。例如: 64 */
+          "nodeCount": 128,
+          /* 共享内存节点大小。例如: 2048 */
+          "nodeBufferSize": 102400
+        }
+      ]
+    },
+
+    /* LocalApiService 配置,可不指定 */
+    "LocalApiService": {
+
+      /* 后台服务的线程个数(单位个,默认0,代表不开启服务)*/
+      "workThreadCount": 1,
+
+      /* 超时时间,若不指定则后台任务永不超时。(主动关闭超过此时间的任务,实际任务强制关闭的时间会在1倍超时时间到2倍超时时间内)。单位:ms。*/
+      //"timeout_ms": 10000,
+
+
+      /* 是否 输出本地Api的调用信息到(ApiTrace)Log文件。默认:false */
+      "PrintTrace": false,
+
+
+      /* 静态文件映射器。映射站点静态文件,可多个,可不指定 */
+      "//staticFiles": [
+        {
+          /* api路由前缀,例如 "/demo/ui/*" */
+          "route": "/demo/ui/*",
+          /* api描述,静态文件描述 */
+          "apiName": "demo站点静态文件",
+
+
+          /* 静态文件路径。可为相对路径或绝对路径。若为空或空字符串则默认为入口程序所在目录。demo:"wwwroot/demo" */
+          "rootPath": "wwwroot/demo",
+
+          /* 静态文件类型映射配置的文件路径。可为相对路径或绝对路径。例如"contentTypeMap.json"。若不指定(或指定的文件不存在)则不指定文件类型映射配置 */
+          "contentTypeMapFile": "contentTypeMap.json",
+
+          /* 回应静态文件时额外添加的http回应头。可不指定。 */
+          "responseHeaders": {
+
+            //设置浏览器静态文件缓存3600秒
+            "Cache-Control": "public,max-age=3600"
+          }
+        }
+      ],
+
+
+      /* 默认站点名称,可多个,可不指定 */
+      //"apiStationNames": [ "demo" ],
+
+      /* Api加载器配置 */
+      "//ApiLoaders": [
+        {
+          /* 在此Assembly中查找api加载器(如 Sers.Core.dll 、Sers.NetcoreLoader.dll 、 Sers.Serslot.dll ) */
+          //"loader_assemblyFile": "Sers.Core.dll",
+          /* 加载器的类名,可为 Sers.SersLoader.ApiLoader 、 Sers.NetcoreLoader.ApiLoader、 Sers.Serslot.ApiLoader 等。若不指定则默认为"Sers.SersLoader.ApiLoader" */
+          //"loader_className": "Sers.SersLoader.ApiLoader",
+
+
+          //(通过反射从此包中获取要加载的api)
+          /* 在此Assembly中查找服务(如 Did.SersLoader.Demo.dll)(assembly、assemblyFile、assemblyName 指定任一即可) */
+          "assemblyFile": "Did.SersLoader.Demo.dll",
+
+          /* 在此Assembly中查找服务(如 Did.SersLoader.Demo)(assembly、assemblyFile、assemblyName 指定任一即可) */
+          //"assemblyName": "Did.SersLoader.Demo",
+
+
+          /* 强制指定ApiStation名称。可不指定。(优先级从高到低:  apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
+          //"apiStationName_Force": "",
+
+          /* ApiStation名称。可不指定。(优先级从高到低:  apiStationName_Force 、 在代码上的SsStationNameAttribute特性指定 、 apiStationName 、 appsettings.json指定) */
+          "apiStationName": "demo"
+
+
+          /* 强制路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低:  routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix) */
+          //"routePrefix_Force": "",
+
+          /* 路由前缀,例如:"demo/v1"。可不指定。(优先级从高到低:  routePrefix_Force、在代码上的SsRoutePrefixAttribute特性指定 、 routePrefix ) */
+          //"routePrefix": ""
+        }
+      ],
+
+
+      /* 调用Api时的自定义Scope对象。可不指定。事件顺序为  OnCreateScope -> BeforeCallApi -> OnDispose */
+      "//OnCreateScope": [
+        {
+          /* 在此Assembly中加载类 */
+          "assemblyFile": "Sers.ApiTrace.dll",
+          /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.ApiScope.IApiScope */
+          "className": "Sers.ApiTrace.ApiScope"
+        }
+      ],
+
+      /* 调用api前的事件,可不指定。事件顺序为  OnCreateScope -> BeforeCallApi -> OnDispose */
+      "//BeforeCallApi": [
+        {
+          /* 在此Assembly中加载类 */
+          //"assemblyFile": "Sers.Core.dll",
+          /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.BeforeCallApi.IBeforeCallApi */
+          "className": "Bearer",
+          //Bearer: 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
+
+          /* 验证at接口的地址 */
+          "api_verifyAt": "/AuthCenter/account/verifyAt",
+          /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
+          "api_httpMethod": "POST"
+        },
+
+        {
+          //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
+          "className": "AccountInCookie",
+          "account": [
+            {
+              "userToken": "admin_123456",
+              //"CallerSource": "Internal",
+              "userInfo": {
+                "name": "超级管理员",
+                "入口": "Gover网关"
+              }
+            }
+          ]
+        }
+      ]
+    },
+
+
+
+    /* ServiceStation配置,可不指定 */
+    "ServiceStation": {
+
+      /* 自动上报cpu Usage。不指定则不上报 */
+      "//UsageReporter": {
+        /* 上报时间间隔(单位:秒) */
+        "intervalSecond": 2
+      },
+
+
+      /* serviceStation站点信息 */
+      "serviceStationInfo": {
+        /* 服务站点名称 */
+        "serviceStationName": "ServiceCenter",
+
+        /* 服务站点版本信息,若不指定则为入口链接库的版本号 */
+        //"stationVersion": "2.1.1",
+
+        /* [json]服务站点额外信息,可不指定 */
+        "info": null
+      }
+
+    },
+
+
+
+    /* ServiceCenter 配置,可不指定 */
+    "ServiceCenter": {
+
+      /* 是否 输出Api注册事件到(Info)Log文件。默认:true  */
+      "ApiRegistEvent_Print": true,
+
+
+      /* api路由管理方式,可不指定。可为:"RESTful","IgnoreHttpMethod"。若不指定或未指定有效值,则默认为"RESTful" */
+      //"ApiRouteType": "IgnoreHttpMethod",
+
+
+      //调用api前的事件,可不指定
+      "BeforeCallApi": [
+        {
+          /* 在此Assembly中加载类 */
+          //"assemblyFile": "Sers.Core.dll",
+          /* 动态加载的类名,必须继承接口 Sers.Core.Module.Api.ApiEvent.BeforeCallApi.IBeforeCallApi */
+          "className": "Bearer",
+          //Bearer: 在调用接口前,会获取 rpcData.http.headers.Authorization(格式为 "Bearer xxxxxx"),并作为参数调用接口api_verifyAt,把返回数据放到 rpcData.user.userInfo
+
+          /* 验证at接口的地址 */
+          "api_verifyAt": "/AuthCenter/account/verifyAt",
+          /* 验证at接口的httpMethod。(如 GET POST 可不指定) */
+          "api_httpMethod": "POST"
+        },
+
+        {
+          //AccountInCookie 在调用接口前,会获取 rpcData.http.headers.Cookie(格式为 "user=xxx;c=7")中的user,在账号列表中比对userToken,回写 CallerSource(rpcData.caller.source) 和 userInfo(rpcData.user.userInfo)
+          //"className": "AccountInCookie",
+          "account": [
+            {
+              "userToken": "admin_123456",
+              //"CallerSource": "Internal",
+              "userInfo": {
+                "name": "超级管理员",
+                "入口": "Gover网关"
+              }
+            }
+          ]
+        }
+      ]
+
+    },
+
+
+    /* 动态加载的App事件 */
+    "AppEvent": [
+      {
+        /* 在此Assembly中加载类 */
+        "assemblyFile": "Sers.Gover.Apm.Zipkin.dll",
+        /* 动态加载的类名,必须继承接口 Sers.Core.Module.App.AppEvent.IAppEvent */
+        //"className": "Sers.Gover.Apm.Zipkin.AppEvent",
+
+        //启用Zipkin链路追踪(自动提交应用调用信息)
+
+        /* 配置 */
+        "SamplingRate": "1.0",
+        "zipkinCollectorUrl": "http://do.sersms.com:9411",
+
+        /* 若不指定则默认为ServiceCenter */
+        "rpcName": "ServiceCenter",
+        "tags": {
+          "route": "{{requestRpc.route}}",
+          "{{requestRpc.route}}": "route",
+          "url": "{{requestRpc.http.url}}",
+          "method": "{{requestRpc.http.method}}",
+          "requestRpc": "{{requestRpc}}",
+          "requestData": "{{requestData}}",
+          "traceName": "demoTrace"
+        }
+      }
+    ]
+
+
+
+  },
+
+
+
+
+
+  /* Vit工具配置,可不指定 */
+  "Vit": {
+
+    /* 日志配置,可不指定 */
+    "Logger": {
+      /* print the log to console. default:false  */
+      "PrintToConsole": true
+    },
+
+
+    /* 序列化配置,可不指定 */
+    "Serialization": {
+      /* 序列化字符编码。可不指定,默认 UTF8。只可为 UTF7,UTF8,UTF32,ASCII,Unicode。 */
+      "Encoding": "UTF8",
+
+      /* 时间序列化格式。可不指定,默认 "yyyy-MM-dd HH:mm:ss" */
+      "DateTimeFormat": "yyyy-MM-dd HH:mm:ss"
+    },
+
+
+    "//Kestrel": {
+      /* (int64) the maximum allowed size of any request body in bytes.  When set to null, the maximum request body size is unlimited. */
+      "MaxRequestBodySize": 2000000000,
+
+      /* (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. */
+      "ValueLengthLimit": 2000000000,
+
+      /* (int64) A limit for the length of each multipart body. Forms sections that exceed this limit will throw an System.IO.InvalidDataException when parsed. */
+      "MultipartBodyLengthLimit": 2000000000
+    }
+
+  }
+
+
+
+
+}

+ 17 - 0
dotnet/netfx/ServiceCenter/App.ServiceCenter.NetFx/packages.config

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Fleck" version="1.1.0" targetFramework="net461" />
+  <package id="Microsoft.DotNet.PlatformAbstractions" version="2.0.0" targetFramework="net461" />
+  <package id="Microsoft.Extensions.DependencyModel" version="2.0.0" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
+  <package id="Sers.CL.Ipc.NamedPipe" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.CL.Socket.Iocp" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.CL.Socket.ThreadWait" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.CL.WebSocket" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.Core" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.Gover" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.Hardware" version="2.1.1.373" targetFramework="net461" />
+  <package id="Sers.ServiceCenter" version="2.1.1.373" targetFramework="net461" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net461" />
+  <package id="Vit.Core" version="2.1.1.373" targetFramework="net461" />
+</packages>