CSharpTest.Net
InstallService Method
See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Commands Namespace > ServiceCommands.Installation Class : InstallService Method

svcName
The name of the Win32 Service to install.
displayName
The description of the Win32 Service.
startupType
The service startup type: Automatic, Manual, or Disabled.
serviceAccount
The service account: LocalService, NetworkService, or LocalSystem.
commandName
The command to run as a service.
arguments
The arguments required to run the command.
ci
The current command interpreter, used to verify the command 'RunAsService' and the commandName provided.
executable
Optional, The path to the executable that is running.

Glossary Item Box

Installs a Win32 service that runs a single command on this executable when started. While typically used for the HostHTTP command, it will operate for any command. Commands hosted as a service may use the Console.ReadLine() to wait for the service-stop command.

Syntax

Visual Basic (Declaration) 
Public Shared Sub InstallService( _
   ByVal svcName As String, _
   ByVal displayName As String, _
   ByVal startupType As ServiceStartMode, _
   ByVal serviceAccount As ServiceAccount, _
   ByVal commandName As String, _
   ByVal arguments() As String, _
   ByVal ci As ICommandInterpreter, _
   ByVal executable As String _
) 
C# 
public static void InstallService( 
   string svcName,
   string displayName,
   ServiceStartMode startupType,
   ServiceAccount serviceAccount,
   string commandName,
   string[] arguments,
   ICommandInterpreter ci,
   string executable
)

Parameters

svcName
The name of the Win32 Service to install.
displayName
The description of the Win32 Service.
startupType
The service startup type: Automatic, Manual, or Disabled.
serviceAccount
The service account: LocalService, NetworkService, or LocalSystem.
commandName
The command to run as a service.
arguments
The arguments required to run the command.
ci
The current command interpreter, used to verify the command 'RunAsService' and the commandName provided.
executable
Optional, The path to the executable that is running.

Exceptions

ExceptionDescription
System.ApplicationExceptionThe exception that is thrown when a non-fatal application error occurs.
System.ArgumentNullExceptionThe exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys