private void InitServices() { if (TheBaseAssets.MyServiceHostInfo.IsCloudService) { return; } List <TheThing> tDevList = TheThingRegistry.GetThingsOfEngine(MyBaseEngine.GetEngineName()); if (tDevList.Count > 0) { foreach (TheThing tDev in tDevList) { switch (tDev.DeviceType) { case eWebAppTypes.TheWebApp: TheRelayAppInfo tApp = new TheRelayAppInfo(tDev, null, this); if (string.IsNullOrEmpty(tApp.HomePage)) { tApp.HomePage = "/"; } if (!tApp.HomePage.StartsWith("/")) { tApp.HomePage = "/" + tApp.HomePage; } tApp.SSID = TheScopeManager.GetScrambledScopeID(); TheThingRegistry.RegisterThing(tApp); break; } } } }
private static TheMirrorCache <TheRequestData> ReqBuffer; //DIC-Allowed private void sinkScopeIDUpdate(bool DoReq) { List <TheThing> tDevList = TheThingRegistry.GetThingsOfEngine(MyBaseEngine.GetEngineName()); if (tDevList.Count > 0) { foreach (TheThing tDev in tDevList) { if (tDev.DeviceType == eWebAppTypes.TheWebApp) { TheRelayAppInfo tApp = tDev.GetObject() as TheRelayAppInfo; if (tApp != null && TheCommonUtils.IsUrlLocalhost(tApp.HostUrl)) // tApp.HostUrl.Equals(TheBaseAssets.MyServiceHostInfo.MyStation URL)) { tApp.SSID = TheScopeManager.GetScrambledScopeID(); TheThingRegistry.UpdateThing(tDev, true); } } } } }
private async Task <TheBaseApplication> StartCde(CdeConfiguration config) { try { LoadAlternateCryptoLib(config.CryptoLibConfig); TheScopeManager.SetApplicationID(config.ApplicationId); TheBaseAssets.MyServiceHostInfo = new TheServiceHostInfo(cdeHostType.Application) { Title = config.ApplicationTitle, ApplicationName = config.ApplicationName, ApplicationTitle = config.PortalTitle, DebugLevel = GetDebugLevel(config.DebugLevel, eDEBUG_LEVELS.ESSENTIALS), MyStationPort = config.HttpPort, MyStationWSPort = config.WsPort, cdeMID = TheCommonUtils.CGuid(config.StorageId), FailOnAdminCheck = config.FailOnAdminCheck, CloudServiceRoute = config.CloudServiceRoutes, LocalServiceRoute = config.LocalServiceRoutes, IsCloudService = config.IsCloudService, ISMMainExecutable = Assembly.GetEntryAssembly()?.GetName().Name, CurrentVersion = config.ApplicationVersion, AllowLocalHost = config.AllowLocalHost, PreShutDownDelay = config.PreShutdownDelay }; TheBaseAssets.MyServiceHostInfo.IgnoredEngines.AddRange(config.LogIgnore.Split(';')); IDictionary <string, string> arguments = new Dictionary <string, string> { { "DontVerifyTrust", $"{config.DontVerifyTrust}" }, { "UseUserMapper", $"{config.UseUserMapper}" }, { "UseRandomDeviceID", $"{config.UseRandomDeviceId}" }, { "AROLE", eEngineName.NMIService + ";" + eEngineName.ContentService }, { "SROLE", eEngineName.NMIService + ";" + eEngineName.ContentService } }; if (!string.IsNullOrEmpty(config.ScopeId)) { arguments["EasyScope"] = config.ScopeId; } arguments = MergeDictionaries(arguments, config.AdditionalArguments); var app = new TheBaseApplication(); var startTime = DateTimeOffset.UtcNow; if (!app.StartBaseApplication(null, arguments)) { throw new InvalidOperationException("Failed to start CDE base application!"); } if (config.UseRandomScopeId && string.IsNullOrEmpty(TheScopeManager.GetScrambledScopeID())) { if (!TheScopeManager.SetScopeIDFromEasyID(TheScopeManager.GenerateNewScopeID())) { throw new InvalidOperationException("Failed to apply random scope!"); } } _log.LogDebug("Started CDE Base application after {milliseconds} ms", DateTimeOffset.UtcNow.Subtract(startTime).TotalMilliseconds); startTime = DateTimeOffset.UtcNow; await TheBaseEngine.WaitForEnginesStartedAsync(); _log.LogDebug("Started CDE engines after {milliseconds} ms", DateTimeOffset.UtcNow.Subtract(startTime).TotalMilliseconds); startTime = DateTimeOffset.UtcNow; await TheBaseEngine.WaitForStorageReadinessAsync(true); _log.LogDebug("Started CDE Storage after {milliseconds} ms", DateTimeOffset.UtcNow.Subtract(startTime).TotalMilliseconds); return(app); } catch (Exception ex) { _log.LogCritical(ex, "Failed to start CDE"); throw; } }