Lith 10 місяців тому
батько
коміт
624212cc11
30 змінених файлів з 130 додано та 444 видалено
  1. 0 4
      dotnet/.editorconfig
  2. 0 2
      dotnet/Gateway/App.Gateway/App.Gateway.csproj
  3. 4 3
      dotnet/Gateway/App.Gateway/Program.cs
  4. 4 4
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/App/SersApplication.cs
  5. 2 2
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Env/SersEnvironment.cs
  6. 6 5
      dotnet/Library/Sers/Sers.Serslot/Sers.Serslot/SerslotServer.LoadSerslotApi.cs
  7. 10 8
      dotnet/Library/Sers/Sers.Serslot/Sers.Serslot/SerslotServer.cs
  8. 1 1
      dotnet/Library/Vit/Vit.Core/Vit.Core/Vit.Core.csproj
  9. 8 9
      dotnet/Library/Vit/Vit.Net.Http.FormFile/MultipartForm.cs
  10. 1 1
      dotnet/Library/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj
  11. 1 1
      dotnet/Library/Vit/Vit.WebHost/Vit.WebHost.csproj
  12. 0 16
      dotnet/Sers.sln
  13. 0 2
      dotnet/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj
  14. 1 1
      dotnet/ServiceCenter/App.Gover.Gateway/wwwroot/_gover_/ServiceStation.html
  15. 0 1
      dotnet/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj
  16. 9 9
      dotnet/ServiceCenter/App.ServiceCenter/Program.cs
  17. 4 2
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Controllers/ValuesController.cs
  18. 0 10
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Did.Serslot.Demo.csproj
  19. 54 16
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Program.cs
  20. 0 47
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Startup.cs
  21. 0 11
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Did.Serslot.HelloWorld.csproj
  22. 19 17
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Program.cs
  23. 0 47
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Startup.cs
  24. 0 45
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Controllers/ValuesController.cs
  25. 0 28
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Did.Serslot.HelloWorld60.csproj
  26. 0 26
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Program.cs
  27. 0 31
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Properties/launchSettings.json
  28. 0 80
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Startup.cs
  29. 0 8
      dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/appsettings.json
  30. 6 7
      dotnet/ServiceStation/Demo/StressTest/App.Robot.Station/Program.cs

+ 0 - 4
dotnet/.editorconfig

@@ -1,4 +0,0 @@
-[*.cs]
-
-# CS1591: 缺少对公共可见类型或成员的 XML 注释
-dotnet_diagnostic.CS1591.severity = none

+ 0 - 2
dotnet/Gateway/App.Gateway/App.Gateway.csproj

@@ -24,8 +24,6 @@
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.App" />
-
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Ipc\Sers.CL.Ipc.SharedMemory\Sers.CL.Ipc.SharedMemory.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\WebSocket\Sers.CL.WebSocket\Sers.CL.WebSocket.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Zmq\FullDuplex\Sers.CL.Zmq.FullDuplex\Sers.CL.Zmq.FullDuplex.csproj" />

+ 4 - 3
dotnet/Gateway/App.Gateway/Program.cs

@@ -1,6 +1,8 @@
 using System;
+
 using Sers.Gateway;
 using Sers.ServiceStation;
+
 using Vit.Core.Module.Log;
 
 namespace App.Gateway
@@ -12,16 +14,15 @@ namespace App.Gateway
             try
             {
 
-                #region (x.1)初始化ServiceStation
+                #region init ServiceStation
                 ServiceStation.Init();
 
                 //ServiceStation.Discovery(typeof(Program).Assembly);
                 if (!ServiceStation.Start())
                 {
-                    Logger.Error("无法连接服务中心。站点关闭");
+                    Logger.Error("can not connect to ServiceCenter. Closing station now.");
                     return;
                 }
-
                 #endregion
 
                 GatewayHelp.Bridge();

+ 4 - 4
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/App/SersApplication.cs

@@ -172,18 +172,18 @@ namespace Sers.Core.Module.App
 
         static SersApplication()
         {
-            #region (x.1)serviceStationInfo
+            #region #1 serviceStationInfo
             {
                 serviceStationInfo = Appsettings.json.GetByPath<ServiceStationInfo>("Sers.ServiceStation.serviceStationInfo") 
                     ?? new ServiceStationInfo();
 
-                //(x.1) stationVersion
+                // ##1 stationVersion
                 if (string.IsNullOrEmpty(serviceStationInfo.stationVersion))
                 {
                     serviceStationInfo.stationVersion = SersEnvironment.GetEntryAssemblyVersion();
                 }
 
-                //(x.2) serviceStationKey
+                // ##2 serviceStationKey
                 serviceStationInfo.serviceStationKey = null;
                 //if (string.IsNullOrEmpty(serviceStationInfo.serviceStationKey))
                 //{
@@ -192,7 +192,7 @@ namespace Sers.Core.Module.App
             }
             #endregion
 
-            #region (x.2)deviceInfo
+            #region #2 deviceInfo
             {
                 deviceInfo = EnvHelp.GetDeviceInfo();
 

+ 2 - 2
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Env/SersEnvironment.cs

@@ -6,12 +6,12 @@ namespace Sers.Core.Module.Env
     public class SersEnvironment
     {
         /// <summary>
-        /// 每台机器的deviceKey在任何时候都唯一
+        /// deviceKey of every server machines is always unique at anytime
         /// </summary>
         public static   string deviceKey => EnvHelp.MachineUnqueKey;
 
         /// <summary>
-        /// 每个服务站点的serviceStationKey在任何时候都唯一
+        /// serviceStationKey of every service station is always unique at anytime
         /// </summary>
         public static string serviceStationKey => EnvHelp.AppUnqueKey;
 

+ 6 - 5
dotnet/Library/Sers/Sers.Serslot/Sers.Serslot/SerslotServer.LoadSerslotApi.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Reflection;
+
 using Sers.Core.Module.Api.ApiDesc;
 using Sers.Core.Module.Api.LocalApi;
 using Sers.SersLoader;
@@ -9,11 +10,11 @@ using Vit.Extensions;
 
 namespace Sers.Serslot
 {
-    public partial class SerslotServer 
+    public partial class SerslotServer
     {
 
         /// <summary>
-        /// µ÷ÓÃSerslot¼ÓÔØÆ÷¼ÓÔØapi
+        ///  load apis by Serslot ApiLoader
         /// </summary>
         /// <param name="data"></param>
         /// <param name="assembly"></param>
@@ -24,7 +25,7 @@ namespace Sers.Serslot
                 return;
             }
 
-            #region (x.1) api from host
+            #region #1 api from host
             var config = new SersLoader.ApiLoaderConfig { assembly = assembly };
 
             Func<SsApiDesc, ApiLoaderConfig, IApiNode> CreateApiNode =
@@ -39,8 +40,8 @@ namespace Sers.Serslot
             #endregion
 
 
-            //(x.2)load api from appsettings.json::serslot.extApi
-            data.LoadSerslotExtApi(apiDesc=> new LocalApiNode(apiDesc, this));
+            // #2 load api from appsettings.json::serslot.extApi
+            data.LoadSerslotExtApi(apiDesc => new LocalApiNode(apiDesc, this));
 
         }
     }

+ 10 - 8
dotnet/Library/Sers/Sers.Serslot/Sers.Serslot/SerslotServer.cs

@@ -2,9 +2,11 @@ using System;
 using System.Reflection;
 using System.Threading;
 using System.Threading.Tasks;
+
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting.Server;
 using Microsoft.AspNetCore.Http.Features;
+
 using Vit.Core.Module.Log;
 using Vit.Extensions;
 
@@ -42,11 +44,11 @@ namespace Sers.Serslot
             OnProcessRequest(features);
 
             return _responseFeature;
-        } 
+        }
 
         #endregion
 
- 
+
 
 
         public IFeatureCollection Features { get; } = new FeatureCollection();
@@ -56,7 +58,7 @@ namespace Sers.Serslot
         {
             try
             {
-                #region (x.1) build OnProcessRequest               
+                #region #1 build OnProcessRequest
                 OnProcessRequest = (features) =>
                 {
 
@@ -83,7 +85,7 @@ namespace Sers.Serslot
 
                         //var _responseFeature = features.Get<IHttpResponseFeature>() as SerslotResponseFeature;
                         //if (_responseFeature != null)
-                        //{                           
+                        //{
                         //    _responseFeature.FireOnStarting();
                         //    _responseFeature.FireOnCompleted();
                         //}
@@ -98,9 +100,9 @@ namespace Sers.Serslot
                 #endregion
 
 
-                #region (x.2) start ServiceStation                
+                #region #2 start ServiceStation
 
-                #region (x.x.1) Init
+                #region ##1 Init
                 ServiceStation.ServiceStation.Init();
                 Sers.Core.Module.App.SersApplication.onStop += () =>
                 {
@@ -113,7 +115,7 @@ namespace Sers.Serslot
 
                 Logger.Info("[Serslot] Mode: BackgroundTask");
 
-                #region (x.x.2)¼ÓÔØapi           
+                #region ##2 load apis
 
                 ServiceStation.ServiceStation.Instance.LoadApi();
 
@@ -121,7 +123,7 @@ namespace Sers.Serslot
 
                 #endregion
 
-                //(x.x.3)Start ServiceStation
+                // ##3 Start ServiceStation
                 if (!ServiceStation.ServiceStation.Start())
                 {
                     Dispose();

+ 1 - 1
dotnet/Library/Vit/Vit.Core/Vit.Core/Vit.Core.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.22-temp</Version>
+        <Version>2.1.22</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 8 - 9
dotnet/Library/Vit/Vit.Net.Http.FormFile/MultipartForm.cs

@@ -41,7 +41,7 @@ namespace Vit.Net.Http.FormFile
     /// </summary>
     public class MultipartForm
     {
-        public Dictionary<string,string> form { get; private set; }
+        public Dictionary<string, string> form { get; private set; }
         public List<FormFile> files { get; private set; }
 
 
@@ -57,12 +57,12 @@ namespace Vit.Net.Http.FormFile
             {
                 ReadMultipartForm(this, stream, ContentType);
             }
-           
+
         }
 
 
         #region ReadMultipartForm
-        private static async Task<MultipartForm> ReadMultipartForm(MultipartForm formData,Stream Body, string ContentType)
+        private static MultipartForm ReadMultipartForm(MultipartForm formData, Stream Body, string ContentType)
         {
             var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(ContentType).Boundary).Value;
             var reader = new MultipartReader(boundary, Body);
@@ -70,27 +70,26 @@ namespace Vit.Net.Http.FormFile
 
             formData.files = new List<FormFile>();
             formData.form = new Dictionary<string, string>();
-     
 
 
             MultipartSection section;
-            while ((section = await reader.ReadNextSectionAsync()) != null)
-            {        
+            while ((section = reader.ReadNextSectionAsync().Result) != null)
+            {
                 ContentDispositionHeaderValue contentDisposition = section.GetContentDispositionHeader();
                 if (contentDisposition == null) continue;
 
                 if (contentDisposition.IsFileDisposition())
                 {
                     var file = section.AsFileSection();
-                    byte[] buff = await section.Body.ToBytesAsync();
-                    //byte[] buff = await file.FileStream.ToBytesAsync();                    
+                    byte[] buff = section.Body.ToBytes();
+                    //byte[] buff = await file.FileStream.ToBytesAsync();
 
                     formData.files.Add(new FormFile { formKey = file.Name, fileName = contentDisposition.FileName.ToString(), content = buff });
                 }
                 else if (contentDisposition.IsFormDisposition())
                 {
                     var form = section.AsFormDataSection();
-                    formData.form[form.Name] = await form.GetValueAsync();                     
+                    formData.form[form.Name] = form.GetValueAsync().Result;
                 }
             }
             return formData;

+ 1 - 1
dotnet/Library/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.22-temp</Version>
+        <Version>2.1.22</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 1 - 1
dotnet/Library/Vit/Vit.WebHost/Vit.WebHost.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.22-temp</Version>
+        <Version>2.1.22</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 0 - 16
dotnet/Sers.sln

@@ -145,8 +145,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sers.Serslot", "Sers.Serslo
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Serslot", "Library\Sers\Sers.Serslot\Sers.Serslot\Sers.Serslot.csproj", "{093170D0-D4B4-4274-BE02-A28CB1154B22}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Did.Serslot.HelloWorld60", "ServiceStation\Demo\Serslot\Did.Serslot.HelloWorld60\Did.Serslot.HelloWorld60.csproj", "{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gateway", "Library\Sers\Sers.Gateway\Sers.Gateway\Sers.Gateway.csproj", "{4EADA81F-6554-4A2E-A0F5-2B9459558347}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Core.Util.Shell.Demo", "Library\Vit\Vit.Core\Test\Vit.Core.Util.Shell.Demo\Vit.Core.Util.Shell.Demo.csproj", "{E230747C-FA8C-4BAB-801E-3AA7A07FD9D0}"
@@ -157,11 +155,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Core.Util.Threading.MsT
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken", "Library\Sers\Sers.Core\Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken\Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken.csproj", "{39A9BA34-1369-40C6-BABF-FEC57787165B}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D5E1F6A4-53C3-4C31-ABD8-8A5D13CE4E72}"
-	ProjectSection(SolutionItems) = preProject
-		.editorconfig = .editorconfig
-	EndProjectSection
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -490,14 +483,6 @@ Global
 		{093170D0-D4B4-4274-BE02-A28CB1154B22}.Release|Any CPU.Build.0 = Release|Any CPU
 		{093170D0-D4B4-4274-BE02-A28CB1154B22}.Release|x86.ActiveCfg = Release|Any CPU
 		{093170D0-D4B4-4274-BE02-A28CB1154B22}.Release|x86.Build.0 = Release|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Debug|x86.Build.0 = Debug|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Release|Any CPU.Build.0 = Release|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Release|x86.ActiveCfg = Release|Any CPU
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68}.Release|x86.Build.0 = Release|Any CPU
 		{4EADA81F-6554-4A2E-A0F5-2B9459558347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{4EADA81F-6554-4A2E-A0F5-2B9459558347}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4EADA81F-6554-4A2E-A0F5-2B9459558347}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -610,7 +595,6 @@ Global
 		{DCB42B65-E24A-43AC-9102-E7CDF9B32590} = {37633A5F-54B5-4179-8BCD-B7B422B4857C}
 		{A0686CA6-5BAA-4A0A-BB38-43B5C9E865A7} = {5522AB94-C73C-4BB6-A2DB-8E84061D0D14}
 		{093170D0-D4B4-4274-BE02-A28CB1154B22} = {A0686CA6-5BAA-4A0A-BB38-43B5C9E865A7}
-		{7C7DDF36-CB84-45A4-ABE3-BDBF1C239D68} = {015B5793-0478-4884-A58B-8889639FD65A}
 		{4EADA81F-6554-4A2E-A0F5-2B9459558347} = {E07D5AC5-2B0F-4916-9B10-5038C8C16B71}
 		{E230747C-FA8C-4BAB-801E-3AA7A07FD9D0} = {B0C8734C-7CAC-4EA4-BF49-4ECE4876BB5D}
 		{B464178B-2397-4E83-9320-CFB5A6485378} = {97C34C06-AE79-4E1A-8D04-EB0107643302}

+ 0 - 2
dotnet/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj

@@ -27,8 +27,6 @@
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.App" />
-
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Ipc\Sers.CL.Ipc.SharedMemory\Sers.CL.Ipc.SharedMemory.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\WebSocket\Sers.CL.WebSocket\Sers.CL.WebSocket.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Zmq\FullDuplex\Sers.CL.Zmq.FullDuplex\Sers.CL.Zmq.FullDuplex.csproj" />

+ 1 - 1
dotnet/ServiceCenter/App.Gover.Gateway/wwwroot/_gover_/ServiceStation.html

@@ -143,7 +143,7 @@
                                 </tr>
                                 <tr>
                                     <td> stationVersion </td>
-                                    <td> : {{ (station.serviceStationInfo||{}).stationVersion }} </td>
+                                    <td> : {{ ((station.serviceStationInfo||{}).stationVersion||'').substr(0,20) }} </td>
                                 </tr>
                                 <tr>
                                     <td> startTime </td>

+ 0 - 1
dotnet/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj

@@ -24,7 +24,6 @@
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.App" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Ipc\Sers.CL.Ipc.SharedMemory\Sers.CL.Ipc.SharedMemory.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\WebSocket\Sers.CL.WebSocket\Sers.CL.WebSocket.csproj" />
         <ProjectReference Include="..\..\Library\Sers\Sers.CL\Zmq\FullDuplex\Sers.CL.Zmq.FullDuplex\Sers.CL.Zmq.FullDuplex.csproj" />

+ 9 - 9
dotnet/ServiceCenter/App.ServiceCenter/Program.cs

@@ -13,36 +13,36 @@ namespace App.ServiceCenter
         public static void Main(string[] args)
         {
 
-            //(x.1) Init
+            // #1 Init
             Sers.ServiceCenter.ServiceCenter.Init();
 
 
-            #region (x.2) 初始化扩展模块
+            #region #2 init extension modules
 
-            #region (x.x.1)使用 Gover 服务治理 模块
+            #region  ##1 use Gover service manage module
             Sers.ServiceCenter.ServiceCenter.Instance.UseGover();
             #endregion
 
 
-            #region (x.x.2)加载 ServiceCenter ApiEvent BeforeCallApi
+            #region ##2 load ServiceCenter ApiEvent BeforeCallApi
             var BeforeCallApi = Sers.Core.Module.Api.ApiEvent.EventBuilder.LoadEvent_BeforeCallApi(Appsettings.json.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
+            // ##3 Load ApiLoadera then load apis from configuration (appsettings.json::Sers.LocalApiService.ApiLoaders )
             Sers.ServiceCenter.ServiceCenter.Instance.LoadApi();
 
-            //(x.x.4)加载系统Api
+            // ##4 Load system manage apis
             Sers.ServiceCenter.ServiceCenter.Instance.LoadSsApi(typeof(Sers.ServiceCenter.Controllers.ServiceStationController).Assembly);
 
             #endregion
 
 
-            //(x.3) Start ServiceCenter
+            // #3 Start ServiceCenter
             if (!Sers.ServiceCenter.ServiceCenter.Start()) return;
 
 
-            #region (x.4) Start gateway if needed
+            #region #4 Start gateway if needed
             try
             {
                 GatewayHelp.Bridge();
@@ -55,7 +55,7 @@ namespace App.ServiceCenter
             #endregion
 
 
-            //(x.5) RunAwait
+            // #5 RunAwait
             Sers.ServiceCenter.ServiceCenter.RunAwait();
 
         }

+ 4 - 2
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Controllers/ValuesController.cs

@@ -1,12 +1,14 @@
 using System;
 using System.Collections.Generic;
-using System.Threading;
 using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http.Features;
+
 using Microsoft.AspNetCore.Mvc;
+
 using Newtonsoft.Json;
+
 using Sers.Core.Module.Api;
 using Sers.Core.Module.Rpc;
+
 using Vit.Core.Util.ComponentModel.Data;
 using Vit.Core.Util.ComponentModel.Model;
 

+ 0 - 10
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Did.Serslot.Demo.csproj

@@ -8,15 +8,6 @@
         <DocumentationFile>bin\Debug\net6.0\Did.Serslot.Demo.xml</DocumentationFile>
     </PropertyGroup>
 
-
-    <ItemGroup>
-        <Folder Include="wwwroot\" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.App" />
-    </ItemGroup>
-
     <ItemGroup>
         <ProjectReference Include="..\..\..\..\Library\Sers\Sers.Serslot\Sers.Serslot\Sers.Serslot.csproj" />
     </ItemGroup>
@@ -27,5 +18,4 @@
         </Content>
     </ItemGroup>
 
-
 </Project>

+ 54 - 16
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Program.cs

@@ -1,27 +1,65 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Vit.Extensions;   //----添加代码1
+using Microsoft.Extensions.DependencyInjection;
 
-namespace Did.Serslot.Demo
+using Vit.Extensions;   //---- add code 1
+
+namespace App
 {
     public class Program
     {
         public static void Main(string[] args)
         {
-            CreateWebHostBuilder(args).Build().Run();
+            var builder = WebApplication.CreateBuilder(args);
+
+            #region #1 config WebHost
+            {
+                builder.WebHost
+                    .TryUseSerslot()  //---- add code 2
+                    .UseUrls(Vit.Core.Util.ConfigurationManager.Appsettings.json.GetByPath<string[]>("server.urls"))  //---- add code 3
+                    ;
+            }
+            #endregion
+
+
+            #region ##2 Add services to the container.
+            {
+                builder.Services.AddControllers()
+                    .AddJsonOptions(options =>
+                {
+                    //Json Serialize config
+
+                    options.JsonSerializerOptions.AddConverter_Newtonsoft();
+                    options.JsonSerializerOptions.AddConverter_DateTime();
+
+
+                    options.JsonSerializerOptions.IncludeFields = true;
+
+                    // JsonNamingPolicy.CamelCase makes the first letter lowercase (default), null leaves case unchanged
+                    options.JsonSerializerOptions.PropertyNamingPolicy = null;
+
+                    // set the JSON encoder to allow all Unicode characters, preventing the default behavior of encoding non-ASCII characters.
+                    options.JsonSerializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All);
+
+                    // Ignore null values
+                    options.JsonSerializerOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull;
+
+                    // extra comma at the end of a list of JSON values in an object or array is allowed (and ignored) within the JSON payload being deserialized.
+                    options.JsonSerializerOptions.AllowTrailingCommas = true;
+
+                });
+
+            }
+            #endregion
+
+            var app = builder.Build();
+
+
+            //app.UseAuthorization();
+            app.MapControllers();
+
+            app.Run();
         }
 
-        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
-            WebHost.CreateDefaultBuilder(args)
-                .TryUseSerslot()  //----添加代码2
-                .UseUrls(Vit.Core.Util.ConfigurationManager.Appsettings.json.GetByPath<string[]>("server.urls")) //----添加代码3
-                .UseStartup<Startup>();
     }
 }

+ 0 - 47
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.Demo/Startup.cs

@@ -1,47 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.HttpsPolicy;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-namespace Did.Serslot.Demo
-{
-    public class Startup
-    {
-        public Startup(IConfiguration configuration)
-        {
-            Configuration = configuration;
-        }
-
-        public IConfiguration Configuration { get; }
-
-        // This method gets called by the runtime. Use this method to add services to the container.
-        public void ConfigureServices(IServiceCollection services)
-        {
-            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
-        }
-
-        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
-        {
-            if (env.IsDevelopment())
-            {
-                app.UseDeveloperExceptionPage();
-            }
-            else
-            {
-                app.UseHsts();
-            }
-
-            //app.UseHttpsRedirection();
-            app.UseMvc();
-        }
-    }
-}

+ 0 - 11
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Did.Serslot.HelloWorld.csproj

@@ -8,15 +8,6 @@
         <DocumentationFile>bin\Debug\net6.0\Did.Serslot.HelloWorld.xml</DocumentationFile>
     </PropertyGroup>
 
-
-    <ItemGroup>
-        <Folder Include="wwwroot\" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.App" />
-    </ItemGroup>
-
     <ItemGroup>
         <ProjectReference Include="..\..\..\..\Library\Sers\Sers.Serslot\Sers.Serslot\Sers.Serslot.csproj" />
     </ItemGroup>
@@ -27,6 +18,4 @@
         </Content>
     </ItemGroup>
 
-
-
 </Project>

+ 19 - 17
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Program.cs

@@ -1,26 +1,28 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Vit.Extensions;   //----添加代码1
-
-namespace Did.Serslot.HelloWorld
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+
+using Vit.Extensions;   //---- add code 1
+
+namespace App
 {
     public class Program
     {
         public static void Main(string[] args)
         {
-            CreateWebHostBuilder(args).Build().Run();
+            var builder = WebApplication.CreateBuilder(args);
+
+            builder.WebHost.TryUseSerslot();  //---- add code 2 
+
+            builder.Services.AddControllers();
+
+            var app = builder.Build();
+
+
+            //app.UseAuthorization();
+            app.MapControllers();
+
+            app.Run();
         }
 
-        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
-            WebHost.CreateDefaultBuilder(args)
-                .UseSerslot()  //----添加代码2
-                .UseStartup<Startup>();
     }
 }

+ 0 - 47
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld/Startup.cs

@@ -1,47 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.HttpsPolicy;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-namespace Did.Serslot.HelloWorld
-{
-    public class Startup
-    {
-        public Startup(IConfiguration configuration)
-        {
-            Configuration = configuration;
-        }
-
-        public IConfiguration Configuration { get; }
-
-        // This method gets called by the runtime. Use this method to add services to the container.
-        public void ConfigureServices(IServiceCollection services)
-        {
-            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
-        }
-
-        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
-        {
-            if (env.IsDevelopment())
-            {
-                app.UseDeveloperExceptionPage();
-            }
-            else
-            {
-                app.UseHsts();
-            }
-
-            //app.UseHttpsRedirection();
-            app.UseMvc();
-        }
-    }
-}

+ 0 - 45
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Controllers/ValuesController.cs

@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Did.Serslot.HelloWorld.Controllers
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class ValuesController : ControllerBase
-    {
-        // GET api/values
-        [HttpGet]
-        public ActionResult<IEnumerable<string>> Get()
-        {
-            return new string[] { "value1", "value2" };
-        }
-
-        // GET api/values/5
-        [HttpGet("{id}")]
-        public ActionResult<string> Get(int id)
-        {
-            return "value";
-        }
-
-        // POST api/values
-        [HttpPost]
-        public void Post([FromBody] string value)
-        {
-        }
-
-        // PUT api/values/5
-        [HttpPut("{id}")]
-        public void Put(int id, [FromBody] string value)
-        {
-        }
-
-        // DELETE api/values/5
-        [HttpDelete("{id}")]
-        public void Delete(int id)
-        {
-        }
-    }
-}

+ 0 - 28
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Did.Serslot.HelloWorld60.csproj

@@ -1,28 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
-
-    <PropertyGroup>
-        <TargetFramework>net6.0</TargetFramework>
-    </PropertyGroup>
-
-    <PropertyGroup>
-        <DocumentationFile>bin\Debug\net6.0\Did.Serslot.HelloWorld60.xml</DocumentationFile>
-    </PropertyGroup>
-
-
-    <ItemGroup>
-        <Folder Include="wwwroot\" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <ProjectReference Include="..\..\..\..\Library\Sers\Sers.Serslot\Sers.Serslot\Sers.Serslot.csproj" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <Content Update="appsettings.json">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </Content>
-    </ItemGroup>
-
-
-
-</Project>

+ 0 - 26
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Program.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Vit.Extensions;   //----添加代码1
-
-namespace Did.Serslot.HelloWorld
-{
-    public class Program
-    {
-        public static void Main(string[] args)
-        {
-            CreateWebHostBuilder(args).Build().Run();
-        }
-
-        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
-            WebHost.CreateDefaultBuilder(args)
-                .UseSerslot()  //----添加代码2
-                .UseStartup<Startup>();
-    }
-}

+ 0 - 31
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Properties/launchSettings.json

@@ -1,31 +0,0 @@
-{
-  "iisSettings": {
-    "windowsAuthentication": false,
-    "anonymousAuthentication": false,
-    "iisExpress": {
-      "applicationUrl": "http://localhost:5500",
-      "sslPort": 0
-    }
-  },
-  "$schema": "http://json.schemastore.org/launchsettings.json",
-  "profiles": {
-    "console": {
-      "commandName": "Project",
-      "launchBrowser": true,
-      "launchUrl": "api/values",
-      "environmentVariables": {
-        "ASPNETCORE_ENVIRONMENT": "Development"
-      },
-      "applicationUrl": "https://localhost:5501;http://localhost:5500"
-    },
-    "IIS Express": {
-      "commandName": "IISExpress",
-      "launchBrowser": true,
-      "launchUrl": "api/values",
-      "environmentVariables": {
-        "ASPNETCORE_ENVIRONMENT": "Development"
-      }
-    }
-
-  }
-}

+ 0 - 80
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/Startup.cs

@@ -1,80 +0,0 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using Vit.Extensions;
-
-namespace Did.Serslot.HelloWorld
-{
-    public class Startup
-    {
-        public Startup(IConfiguration configuration)
-        {
-            Configuration = configuration;
-        }
-
-        public IConfiguration Configuration { get; }
-
-        // This method gets called by the runtime. Use this method to add services to the container.
-        public void ConfigureServices(IServiceCollection services)
-        {
-
-            services.AddControllers()
-                .AddJsonOptions(options =>
-            {
-                //Json序列化全局配置
-#if NETCOREAPP3_0_OR_GREATER
-
-                options.JsonSerializerOptions.AddConverter_Newtonsoft();
-                options.JsonSerializerOptions.AddConverter_DateTime();
-
-
-                options.JsonSerializerOptions.IncludeFields = true;
-
-                //JsonNamingPolicy.CamelCase首字母小写(默认),null则为不改变大小写
-                options.JsonSerializerOptions.PropertyNamingPolicy = null;
-                //取消Unicode编码 
-                options.JsonSerializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All);
-                //忽略空值
-                options.JsonSerializerOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull;
-                //options.JsonSerializerOptions.IgnoreNullValues = true;
-                //允许额外符号
-                options.JsonSerializerOptions.AllowTrailingCommas = true;
-
-#else
-
-                //忽略循环引用
-                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
-
-                //不更改元数据的key的大小写
-                options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
-#endif
-            });
-
-        }
-
-        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
-        {             
-
-            if (env.IsDevelopment())
-            {
-                app.UseDeveloperExceptionPage();
-                //app.UseSwagger();
-                //app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebApplication1 v1"));
-            }
-
-            app.UseRouting();
-
-            //app.UseAuthorization();
-
-            app.UseEndpoints(endpoints =>
-            {
-                endpoints.MapControllers();
-            });
-
-        }
-    }
-}

+ 0 - 8
dotnet/ServiceStation/Demo/Serslot/Did.Serslot.HelloWorld60/appsettings.json

@@ -1,8 +0,0 @@
-{
-  "Logging": {
-    "LogLevel": {
-      "Default": "Warning"
-    }
-  },
-  "AllowedHosts": "*"
-}

+ 6 - 7
dotnet/ServiceStation/Demo/StressTest/App.Robot.Station/Program.cs

@@ -1,7 +1,6 @@
-using App.Robot.Station.Logical;
-
-using Sers.SersLoader;
+using Sers.SersLoader;
 using Sers.ServiceStation;
+
 using Vit.Extensions;
 
 namespace App.Robot.Station
@@ -16,19 +15,19 @@ namespace App.Robot.Station
             //Sers.Core.Module.App.SersApplication.serviceStationInfo.stationVersion = "2.0.1";
 
 
-            //(x.1) Init
+            // #1 Init
             ServiceStation.Init();
 
-            //(x.2) 加载Api
+            // #2 Load apis
             ServiceStation.Instance.LoadSersApi(typeof(Program).Assembly, new ApiLoaderConfig { apiStationName = "_robot_" });
             ServiceStation.Instance.localApiService.LoadApi_StaticFiles();
 
 
-            //(x.3) Start
+            // #3 Start
             ServiceStation.Start();
 
 
-            //(x.4) RunAwait
+            // #4 RunAwait
             ServiceStation.RunAwait();
 
         }