الاثنين، 12 ديسمبر 2011

Create a Setup project for a Windows ServicE


Create a Setup project for a Windows Service

Create a Setup project for a Windows Service 
This section describes how to create a Windows Service project and how to use a compiled Setup project to install the Windows Service. 
Create a Windows Service project 
1. Click Start, point to Programs, point to Microsoft Visual Studio .NET or Microsoft Visual Studio 2005, and then click Microsoft Visual Studio .NET or Microsoft Visual Studio 2005. 
2. On the File menu, point to New, and then click Project. 
3. In the New Project dialog box, follow these steps: 
a. Under Project Types, click Visual Basic Projects or click Windows under Visual Basic. 
b. Under Templates, click Windows Service. 
c. In the Name box, type LogWriterService. 
d. In the Location box, type C:\, and then click OK. 
4. In Solution Explorer, right-click Service1.vb, and then click View Code. 
5. In the OnStart event handler, replace the comments with the following code. 

EventLog.WriteEntry("My simple service started.") 

6. In Solution Explorer, double-click Service1.vb. 
7. In the Properties dialog box, click Add Installer. 
8. In the Properties dialog box for ServiceInstaller1, change the ServiceName property to LogWriterService. 
9. In Design view, click ServiceProcessInstaller1 in the Code Editor. 
10. In the Properties dialog box, change the Account property to LocalSystem. The LocalService value and the NetworkService value are only available in Microsoft Windows XP and later operating systems. 
Use a compiled Setup project to install the Windows Service 
After you complete the steps in the "Create a Windows Service project" section to configure the Windows Service project, you can add a deployment project that packages the service application so that the service application can be installed. To do this, follow these steps: 
1. Add a new project to your LogWriterService project. 
a. In Solution Explorer, right-click Solution 'LogWriterService', point to Add, and then click New Project. 
b. Under Project Types, click Setup and Depl

ليست هناك تعليقات:

إرسال تعليق