Presentation is loading. Please wait.

Presentation is loading. Please wait.

Install a Windows Service Application 98-362 Windows Development Fundamentals LESSON 3.2.

Similar presentations


Presentation on theme: "Install a Windows Service Application 98-362 Windows Development Fundamentals LESSON 3.2."— Presentation transcript:

1 Install a Windows Service Application 98-362 Windows Development Fundamentals LESSON 3.2

2 98-362 Windows Development Fundamentals LESSON 3.2 Lesson Overview How are Windows ® Service applications installed? In this lesson, you will learn about:  Installing a Windows Service application manually  Using the Component Designer to create installers

3 98-362 Windows Development Fundamentals LESSON 3.2 Anticipatory Set  List the stages in the lifetime of a Windows Service application; give a brief description of each stage, including the related ServiceBase methods.

4 98-362 Windows Development Fundamentals LESSON 3.2 The Need to Install a Service Application  Unlike Windows Forms and Windows Presentation Foundation (WPF) projects, Windows Service applications cannot be run directly from Microsoft Visual Studio ® by simply pressing F5.  Instead, services must be registered with the Services Control Manager—the mechanism that Windows uses to manage Windows Service applications.  Generally, developers can install their service application two different ways:  — Installing (and then uninstalling) the service manually  — Adding installers to your project  Note: A Windows Service application does not start when it is installed. It still must be started to trigger the OnStart method and being operating.

5 98-362 Windows Development Fundamentals LESSON 3.2 Installing a Service Manually  Installutil.exe is a command-line utility used to install—or uninstall—a Windows Services application manually. The user must have Administrator permissions to use Installutil.exe.  After building your project, use the command line and navigate to the folder that contains your executable file. Then run: installutil MyService.exe  To uninstall the Windows Service, repeat the process, adding the /u parameter: installutil /u MyService.exe Note: in these examples, MyService.exe is used to represent the name of your project’s output. You would replace MyService.exe with the file that was created when you built your project.

6 98-362 Windows Development Fundamentals LESSON 3.2 Installers (or Installer Classes)  Installer classes perform programmed actions when the project is installed.  For example, they can tell the setup to install a Windows Service application. To add installers to your project, perform the following steps: 1. Access the Component Designer for your services project. 2. Right-click the background of the Component Designer and select Add Installer. 3. A class called ProjectInstaller is added to the project. 4. Create a setup project (with a custom action). Next, you will need to create a setup project for your application.

7 98-362 Windows Development Fundamentals LESSON 3.2 Setup Projects A setup project creates the setup files necessary to install your application on a target computer. To create one, perform the following steps: 1. In Solution Explorer, right-click the solution and select Add, then New Project. 2. Select Setup And Deployment Projects and Setup Project; give the project a name, such as ServiceSetup. 3. In Solution Explorer, right-click the new project’s name, select Add, and choose Project Output. 4. In the Add Project Output Group dialog box, select Primary Output and click OK.

8 98-362 Windows Development Fundamentals LESSON 3.2 Setup Projects (Continued) – adding a custom action 1. In Solution Explorer, right-click the setup project, select View, and select Custom Actions. 2. When the Custom Actions editor appears, right-click the Custom Actions node and select Add Custom Action. 3. When the Select Item In Project dialog box appears, double-click Application Folder and select Primary Output From [project name] (Active). To install your service, in Solution Explorer, right-click the setup project and select Install; and then proceed through the Setup Wizard that appears.

9 98-362 Windows Development Fundamentals LESSON 3.2 Starting the Service Application  There are several ways to start a service that has been installed. For most users, the Services Control Manager is the typical method.  From Visual Studio, services can be started from the Server Explorer (View menu, Server Explorer) by expanding the Services node and right-clicking the service name.

10 98-362 Windows Development Fundamentals LESSON 3.2 Lesson Review  Using the notes you took during this presentation, create a Windows Service application and add installers and a setup project.


Download ppt "Install a Windows Service Application 98-362 Windows Development Fundamentals LESSON 3.2."

Similar presentations


Ads by Google