Automate delivery of Crystal Reports With a Windows Service
page 4 of 5
by Vince Varallo
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 40041/ 69

Step 3: Install the Windows Service

The last step is to install the Windows Service and run it.  There are a few steps you need to follow in order to have the service install correctly.

1.    Right click on the Service1.cs file and select View Designer from the pop-up menu.

2.    Right click on the Designer and select Add Installer from the pop-up menu.  A new file will be added to the project called ProjectInstaller.cs.

3.    Click on the serviceProcessInstaller1 icon on the designer and view its properties.

4.    You can change the Account property to specify the account the Windows Service should run as when it is executed.  Change the Account to LocalService.

5.    Now click on the serviceInstaller1 icon on the designer and view its properties.

6.    This is where you can define the Description, Display Name, and StartType.  Set the Description to "This service emails reports."  Set the Display Name to "AutomatedReports".  Set the StartType to Automatic.  This will ensure the service start when the computer starts.

7.    Recompile the project again.

8.    Now you can install the service.  To do this you need to use the command line utility call InstallUtil.exe that comes with the Visual Studio.  To open the command prompt click on the Start Button and navigate to All ProgramsàMicrosoft Visual Studio 2008àVisual Studio ToolsàVisual Studio 2008 Command Prompt.

9.    Change the directory to the folder that contains the AutomatedReports.exe file.  This will be in the bin\Debug folder under your project.  If you compiled this for release then it will be under the bin\Release folder.

10. Enter InstallUtil.exe AutomatedReports.exe and press enter.  This will install the executable as a service and it should appear in the Services located in the Administration Tools in Windows.

View Entire Article

User Comments

Title: great article!   
Name: mira minkova
Date: 2013-01-07 6:09:56 AM
very detailed and easy to follow! Thank you!
Title: get or set accessor expected?   
Name: Mike
Date: 2010-07-29 12:52:00 PM
I'm trying to use this example to code a service and I'm receiving a "get or set accessor expected" exception in my RunReport method when I try to instantiate a ReportDocument object...

Any ideas on what the problem might be?

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-22 6:37:44 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search