diff --git a/Stardust.Extensions/TracerMiddleware.cs b/Stardust.Extensions/TracerMiddleware.cs index 7643c1ef..44e5ac65 100644 --- a/Stardust.Extensions/TracerMiddleware.cs +++ b/Stardust.Extensions/TracerMiddleware.cs @@ -195,7 +195,7 @@ public static void SaveServiceAddress(HttpContext ctx) var baseAddress = $"{uri.Scheme}://{uri.Authority}"; var set = NewLife.Setting.Current; - var ss = set.ServiceAddress.Split(",").ToList(); + var ss = set.ServiceAddress?.Split(",").ToList() ?? []; if (!ss.Contains(baseAddress)) { // 过滤掉本机地址 diff --git a/Stardust/StarFactory.cs b/Stardust/StarFactory.cs index 817d761e..199523c5 100644 --- a/Stardust/StarFactory.cs +++ b/Stardust/StarFactory.cs @@ -264,6 +264,7 @@ private Boolean Valid() if (_client == null) { + var set = StarSetting.Current; var client = new AppClient(Server) { Factory = this, @@ -272,6 +273,7 @@ private Boolean Valid() Secret = Secret, ClientId = ClientId, NodeCode = Local?.Info?.Code, + Setting = set, Log = Log, }; diff --git a/Stardust/StarSetting.cs b/Stardust/StarSetting.cs index fb19da12..58042ae4 100644 --- a/Stardust/StarSetting.cs +++ b/Stardust/StarSetting.cs @@ -1,11 +1,12 @@ using System.ComponentModel; using NewLife.Configuration; +using NewLife.Remoting.Clients; namespace Stardust; /// 星尘客户端配置 [Config("Star")] -public class StarSetting : Config +public class StarSetting : Config, IClientSetting { #region 属性 /// 调试开关。默认false @@ -43,5 +44,7 @@ public class StarSetting : Config /// 最大异常采样数。采样周期内,最多只记录指定数量的异常事件,默认10 [Description("最大异常采样数。采样周期内,最多只记录指定数量的异常事件,默认10")] public Int32 MaxErrors { get; set; } = 10; + + String IClientSetting.Code { get => AppKey!; set => AppKey = value; } #endregion } \ No newline at end of file