In Brief

In this chapter, we looked at three important topicsWindows services, Web services, and how to deploy applications. Here's an overview of this chapter's topics:

  • Windows services run in the background, and you have the option of starting them automatically when the computer starts. These services are typically used to configure device drivers such as those that handle printers, CD creation software, audio devices, and data providers like SQL Server. You can give a Windows service a user interface, which often resembles a control panel that opens when the user clicks or right-clicks a taskbar icon. You can create a taskbar icon with the NotifyIcon control in the IDE's toolbox.

  • You can create Windows services in the IDE and the IDE will write much of the C# code you need. Windows services are based on the ServiceBase class. To implement your Windows service, you override various methods of the ServiceBase class, including OnStart and OnStop , to handle Windows service actions.

  • To install Windows services, you need an installer for every service you want to install. That involves using both the ServiceProcessInstaller and ServiceInstaller classes in C#.

  • You can use a Windows service's StartType property to indicate when the service should start. ServiceStartMode.Automatic means that the service should be started automatically when the computer is booted , ServiceStartMode.Disabled means that it cannot be started, and ServiceStartMode.Manual means that the service can only be started manually (by using the Service Control Manager or by an application).

  • You can interact with a Windows service in an application with an object of the ServiceController class. You can call the methods of the service using an object of this class.

  • Web services expose methods that can be called by other code across the Internet. In C#, Web services are based on the WebService class. To expose methods from a Web service, you declare them with the [WebMethod] attribute.

  • You can call the Web methods of Web services if you first add a Web reference to that service. You can do that by right-clicking a project in the Solution Explorer, selecting Add Web Reference, and browsing to the Web service you want in the Add Web Reference dialog box. When you have a Web reference to a Web service, you create a new object corresponding to that service and call the Web methods of that object.

  • To deploy your application, you can create .MSI (Microsoft Installer) files using a setup and deployment project. To create a deployment package for a project, you add a setup and deployment project to the current solution.

  • After your setup project has been created, you build it to create the .MSI file you can deploy to target machines (if they're running the .NET Framework). On the target machine, double-click the .MSI file to open it in the Windows installer. Alternatively, you can also use the setup.exe and setup.ini files created by building the deployment project to install the application.



Microsoft Visual C#. NET 2003 Kick Start
Microsoft Visual C#.NET 2003 Kick Start
ISBN: 0672325470
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net