Each of the sample solutions we have provided for you in our customer portal can also be installed and run as a service.
Each solution implements the .NET System.Configuration.Install Installer class and overrides its Install and Uninstall methods. This allows the application to be easily installed as a service using any of several methods. These include using InstallUtil.exe (included with Microsoft Visual Studio) or the New-Service PowerShell applet.
Use InstallUtil.exe
To use InstallUtil.exe, run the following from the Windows command prompt (this assumes your application is in C:\Getting Started\):
C:\Getting Started\InstallUtil.exe VoiceApp.exe
Use PowerShell Applet
Or, if you are using PowerShell:
PS C:\Getting Started\New-Service -Name "IvrService" -BinaryPathName "C:\Getting Started\VoiceApp.exe"
The application checks at runtime to see if it’s being run interactively; if so, it displays its form and runs as a user application.
However, if it is running under services.exe, it immediately instantiates its main class and begins execution. This allows a single executable to be used for both environments during testing.
See also: