Apply Your Knowledge

Exercises

6.1. Passing Startup Parameters to a Windows Service

When you start a Windows service, you can also pass startup parameters to the service.

In this exercise, I'll create a new Windows service named OrderServiceEx. This Windows service is almost same as OrderService, which was created in Step-by-Step 6.1. The only difference is that OrderServiceEx accepts the value of the NotifyFilter property and the Path property of the FileSystemWatcher component at the time of starting the Windows service.

The startup parameters to a Windows service are given the same way as command-line arguments are provided to a console application. However, the only difference is that rather than accepting the arguments in the Main() method, ...

Get MCAD/MCSD Training Guide (70-320): Developing XML Web Services and Server Components with Visual C#™ .NET and the Microsoft .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.