Advertisement
Guest User

Untitled

a guest
Jul 18th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Diagnostics;
  6. using System.Configuration;
  7. using System.ServiceProcess;
  8. using System.ComponentModel;
  9. using System.Configuration.Install;
  10.  
  11. namespace WindowsService
  12. {
  13. //Allows the installer to run
  14. [RunInstaller(true)]
  15.  
  16. public class WindowsServiceInstaller : Installer
  17. {
  18. //Constructor / Put Initialization code here
  19.  
  20. public WindowsServiceInstaller()
  21. {
  22. //Sets up the connection/control variables
  23. ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
  24. ServiceInstaller serviceInstaller = new ServiceInstaller();
  25.  
  26. //Service Account
  27. serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
  28. serviceProcessInstaller.Username = null;
  29. serviceProcessInstaller.Password = null;
  30.  
  31. //Service details
  32. serviceInstaller.DisplayName = "WinService";
  33. serviceInstaller.StartType = ServiceStartMode.Manual;
  34.  
  35. serviceInstaller.DisplayName = "Windows Service"; //Keep the same as string in WindowsService class
  36.  
  37. //Implements installer
  38. this.Installers.Add(serviceProcessInstaller);
  39. this.Installers.Add(serviceInstaller);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement