async Task PostHttpMainAsync(CancellationToken cancel = default) { if (this.Config.PostUrl._IsEmpty()) { return; } StatManDatabase copy; lock (this.DataLock) { copy = this.Database._CloneWithJson(); } KeyValueList <string, string> vers = new KeyValueList <string, string>(); vers.Add("APPNAME", CoresLib.AppNameFnSafe); vers.Add("OS", Env.OsInfoString); vers.Add("CPU", Env.CpuInfo.ToString()); vers.Add("NUMCPU", Env.NumCpus.ToString()); vers.Add("DOTNET", Env.FrameworkInfoString); vers.Add("EXE", Env.AppExecutableExeOrDllFileName._GetFileName() ?? ""); List <string> versStrs = new List <string>(); vers.ForEach(x => versStrs.Add($"{x.Key}={x.Value}")); var data = Json.NewJsonObject(); foreach (var item in copy.StrValues) { data.TryAdd(item.Key, new JValue(item.Value)); } foreach (var item in copy.LongValues) { data.TryAdd(item.Key, new JValue(item.Value)); } DataVaultData postData = new DataVaultData { TimeStamp = DtOffsetNow, StatUid = copy.Uid, StatAppVer = versStrs._Combine("|"), StatGitCommitId = Dbg.GetCurrentGitCommitId(), StatLocalIp = this.CurrentLocalIp.ToString(), StatLocalFqdn = LocalNet.GetHostInfo(true).HostName, SystemName = Config.SystemName, LogName = Config.LogName, Data = data, }; string postStr = postData._ObjectToJson(); using var http = new WebApi(new WebApiOptions(new WebApiSettings { SslAcceptAnyCerts = true })); var ret = await http.SimplePostJsonAsync(WebMethods.POST, Config.PostUrl, postStr, cancel); if (ret.ToString()._InStr("ok") == false) { throw new CoresException($"Http error: {ret.ToString()._TruncStrEx(1000)}"); } }