forked from hibernating-rhinos/rhino-esb
/
RhinoServiceBusHost.cs
54 lines (45 loc) · 1.1 KB
/
RhinoServiceBusHost.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
namespace Rhino.ServiceBus.Host
{
using System.ServiceProcess;
using Hosting;
internal partial class RhinoServiceBusHost : ServiceBase
{
private RemoteAppDomainHost host;
private string asm;
private string cfg;
public RhinoServiceBusHost()
{
InitializeComponent();
}
public void SetArguments(string assembly, string config)
{
asm = assembly;
cfg = config;
}
protected override void OnStart(string[] ignored)
{
host = new RemoteAppDomainHost(asm, cfg);
host.Start();
}
protected override void OnStop()
{
if (host != null)
host.Close();
}
public void DebugStart(string[] arguments)
{
OnStart(arguments);
}
public void InitialDeployment(ServiceAccount account)
{
var tmpHost = new RemoteAppDomainHost(asm, cfg);
var user = account.ToString();
if (account == ServiceAccount.User)
user = Environment.UserDomainName;
tmpHost.InitialDeployment(user);
tmpHost.Close();
}
}
}