Browse Source

Check service running before checking self restart

hatharry 9 years ago
parent
commit
71386f0ceb
1 changed files with 5 additions and 1 deletions
  1. 5 1
      MediaBrowser.ServerApplication/MainStartup.cs

+ 5 - 1
MediaBrowser.ServerApplication/MainStartup.cs

@@ -45,7 +45,11 @@ namespace MediaBrowser.ServerApplication
         {
         {
             var options = new StartupOptions();
             var options = new StartupOptions();
             _isRunningAsService = options.ContainsOption("-service");
             _isRunningAsService = options.ContainsOption("-service");
-            _canRestartService = CanRestartWindowsService();
+
+            if (_isRunningAsService)
+            {
+                _canRestartService = CanRestartWindowsService();
+            }
 
 
             var currentProcess = Process.GetCurrentProcess();
             var currentProcess = Process.GetCurrentProcess();