mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
More work on WindowsService, still broken
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
@@ -7,7 +8,7 @@ using NzbDrone.Providers;
|
||||
|
||||
namespace NzbDrone
|
||||
{
|
||||
public class ApplicationServer
|
||||
public class ApplicationServer : ServiceBase
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetLogger("Host.App");
|
||||
|
||||
@@ -18,6 +19,13 @@ namespace NzbDrone
|
||||
private readonly ProcessProvider _processProvider;
|
||||
private readonly WebClient _webClient;
|
||||
|
||||
public void IsRunningAsService()
|
||||
{
|
||||
Logger.Warn(base.Container);
|
||||
Logger.Warn(base.ServiceName);
|
||||
|
||||
}
|
||||
|
||||
[Inject]
|
||||
public ApplicationServer(ConfigProvider configProvider, WebClient webClient, IISProvider iisProvider,
|
||||
DebuggerProvider debuggerProvider, EnviromentProvider enviromentProvider,
|
||||
@@ -33,6 +41,13 @@ namespace NzbDrone
|
||||
|
||||
public ApplicationServer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void StartService()
|
||||
{
|
||||
Start();
|
||||
Run(this);
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
@@ -67,7 +82,12 @@ namespace NzbDrone
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Stop()
|
||||
protected override void OnStop()
|
||||
{
|
||||
StopServer();
|
||||
}
|
||||
|
||||
public void StopServer()
|
||||
{
|
||||
Logger.Info("Attempting to stop application.");
|
||||
_iisProvider.StopServer();
|
||||
|
Reference in New Issue
Block a user