public void AddOrUpdateRunningMicroServiceInfo(PalaceClient.RunningMicroserviceInfo runningMicroserviceInfo, string userAgent, string userHostAddress)
    {
        var palaceInfo = PalaceInfoManager.GetOrCreatePalaceInfo(userAgent, userHostAddress);

        if (palaceInfo.HostName == null)
        {
            return;
        }
        palaceInfo.LastHitDate = DateTime.Now;
        var runningList = GetRunningList();

        var key = $"{palaceInfo.MachineName}.{palaceInfo.HostName}.{runningMicroserviceInfo.ServiceName}".ToLower();
        var rms = runningList.SingleOrDefault(i => i.Key == key);

        if (rms == null)
        {
            rms             = new Models.ExtendedRunningMicroServiceInfo();
            rms.ServiceName = runningMicroserviceInfo.ServiceName;
            runningList.Add(rms);
        }
        rms.PalaceInfo          = palaceInfo;
        rms.Location            = runningMicroserviceInfo.Location;
        rms.UserInteractive     = runningMicroserviceInfo.UserInteractive;
        rms.Version             = runningMicroserviceInfo.Version;
        rms.LastWriteTime       = runningMicroserviceInfo.LastWriteTime;
        rms.ThreadCount         = runningMicroserviceInfo.ThreadCount;
        rms.ProcessId           = runningMicroserviceInfo.ProcessId;
        rms.LastUpdateDate      = DateTime.Now;
        rms.ServiceState        = runningMicroserviceInfo.ServiceState;
        rms.StartedDate         = runningMicroserviceInfo.StartedDate;
        rms.CommandLine         = runningMicroserviceInfo.CommandLine;
        rms.PeakPagedMem        = runningMicroserviceInfo.PeakPagedMem;
        rms.PeakVirtualMem      = runningMicroserviceInfo.PeakVirtualMem;
        rms.PeakWorkingSet      = runningMicroserviceInfo.PeakWorkingSet;
        rms.WorkingSet          = runningMicroserviceInfo.WorkingSet;
        rms.AdminUrl            = runningMicroserviceInfo.AdminUrl;
        rms.EnvironmentName     = runningMicroserviceInfo.EnvironmentName;
        rms.PalaceClientVersion = runningMicroserviceInfo.PalaceClientVersion;
        if (rms.ServiceState == "Started")
        {
            UnLockDownload(rms.ServiceName);
        }
        OnChanged?.Invoke();
    }
    public IActionResult RegisterOrUpdateRunningMicroServiceInfo([FromHeader] string authorization, PalaceClient.RunningMicroserviceInfo runningMicroserviceInfo)
    {
        EnsureGoodAuthorization(authorization);

        Collector.AddOrUpdateRunningMicroServiceInfo(runningMicroserviceInfo, HttpContext.GetUserAgent(), HttpContext.GetUserHostAddress());
        return(Ok());
    }