Example #1
0
 private void CheckFileSystem()
 {
     // Shutdown if RunFromZipFailed
     if (_environment.IsZipDeployment(validate: false))
     {
         string path = Path.Combine(_applicationHostOptions.CurrentValue.ScriptPath, ScriptConstants.RunFromPackageFailedFileName);
         if (File.Exists(path))
         {
             _logger.LogError($"Shutting down host due to presence of {path}");
             _applicationLifetime.StopApplication();
         }
     }
 }
Example #2
0
 private void CheckFileSystem()
 {
     if (_environment.ZipDeploymentAppSettingsExist())
     {
         // Check for marker file indicating a zip package failure, and if found stop the application.
         // We never want to run with an incorrect file system.
         string path = Path.Combine(_applicationHostOptions.CurrentValue.ScriptPath, ScriptConstants.RunFromPackageFailedFileName);
         if (File.Exists(path))
         {
             _logger.LogError($"Shutting down host due to presence of {path}");
             _applicationLifetime.StopApplication();
         }
     }
 }
Example #3
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            try
            {
                await _service.StartAsync(cancellationToken);

                _logger.LogInformation($"Service {_service.GetType().FullName} started");
            }
            catch (Exception e)
            {
                _logger.LogCritical(e, $"Error starting hosted service {_service.GetType().FullName}");
                _applicationLifetime.StopApplication();
            }
        }
Example #4
0
        public IActionResult Restart()
        {
            var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
            var rootDir   = _hostEnvironment.ContentRootPath;

            Process.Start(new ProcessStartInfo
            {
                WorkingDirectory = Path.GetDirectoryName(Path.Combine(rootDir, "Updates/WebApi")),
                FileName         = isWindows ? Path.Combine(rootDir, "FlubuCore.WebApi.Updater.exe") : "dotnet FlubuCore.WebApi.Updater.dll",
                Arguments        = isWindows.ToString()
            });

            _applicationLifetime.StopApplication();

            return(Ok());
        }
Example #5
0
 private void Shutdown()
 {
     _applicationLifetime.StopApplication();
 }