1 |
using System;
|
2 |
using System.ComponentModel;
|
3 |
|
4 |
using System.Configuration.Install;
|
5 |
using System.ServiceProcess;
|
6 |
|
7 |
//Tilføj System.Configuration.Install assembly reference
|
8 |
|
9 |
// Denne cklasse bruges
|
10 |
|
11 |
namespace DaoMqPump2
|
12 |
{
|
13 |
[System.ComponentModel.DesignerCategory("Code")]
|
14 |
//[RunInstaller(true)]
|
15 |
public class PumpServiceInstaller : System.Configuration.Install.AssemblyInstaller
|
16 |
{
|
17 |
public PumpServiceInstaller()
|
18 |
{
|
19 |
ServiceProcessInstaller process = new ServiceProcessInstaller();
|
20 |
|
21 |
process.Account = ServiceAccount.LocalSystem;
|
22 |
|
23 |
ServiceInstaller serviceAdmin = new ServiceInstaller();
|
24 |
|
25 |
serviceAdmin.StartType = ServiceStartMode.Manual;
|
26 |
serviceAdmin.ServiceName = "DaoMqPump2";
|
27 |
serviceAdmin.DisplayName = "DAO MQ Pump v2";
|
28 |
|
29 |
// Microsoft didn't add the ability to add a
|
30 |
// description for the services we are going to install
|
31 |
// To work around this we'll have to add the
|
32 |
// information directly to the registry but I'll leave
|
33 |
// this exercise for later.
|
34 |
|
35 |
|
36 |
// now just add the installers that we created to our
|
37 |
// parents container, the documentation
|
38 |
// states that there is not any order that you need to
|
39 |
// worry about here but I'll still
|
40 |
// go ahead and add them in the order that makes sense.
|
41 |
Installers.Add( process );
|
42 |
Installers.Add( serviceAdmin );
|
43 |
}
|
44 |
}
|
45 |
}
|