Using the Server Explorer to Manage Servers


Another important role the Server Explorer can play is as a tool to view and manage a number of aspects of a registered server.

In earlier versions, the IDE enumerated the servers it could see on the LAN so that you could choose from a server to manager. Visual Studio 2005 has tightened security to require that you specifically name the server to register. No, you won't be able to browse servers from this interface. Yes, you can browse for visible SQL Server instances from the ConnectionString dialogs, as I discuss in Chapter 9.


To register a server so that it appears in the Server Explorer Servers list, you'll need to right-click on the Servers icon, choose "Add Server...", and fill in the name of the server to explore. Sure, you can also specify that you want to connect to the server using alternative credentials.

Once a server is registered, an exploded view of the Servers icon lists the available root elements to explore. You can drill into each icon for additional elements, services, and logs to explore. I've expanded the Application Event logs in Figure 4.82 to give you an idea of what I'm talking about.

Figure 4.82. The Servers icon can expose logs, objects, and services to manage.


The Server Explorer "Servers" icon can expose:

  • Crystal Report Services: Assuming you have installed the BusinessObjects Enterprise .NET SDK from a Crystal Reports Server or BusinessObjects Enterprise, you can manage services associated with Crystal reports from this icon.

  • Event Logs: This icon exposes (at least) the Application, Security, and System event logs, as well as any application-defined logs. Keep in mind that each instance of SQL Server creates and uses its own Event Log, so this is a useful place to explore when you're trying to diagnose issues with a specific SQL Server instance. Let's take a closer look at these logs. When I click on the "+" next to the Application event logs and click the "+" next to the MSSQL$SS2K5 icon, I can see the copious list of events generated by the SQL Server 2005 instance running on the selected server.

  • Management Classes: The Server icon now permits developers to explore the .NET Framework's System.Management namespace via the Windows Management Instrumentation (WMI) infrastructure. The Management Classes icon exposes a long list of WMI classes to manage specific Windows operational metrics. I'll let you explore this icon, but consider that virtually every aspect of Windows is exposed here. For example, if you drill into Management Classes | Disk Volumes | C:, the properties page exposes important details like FreeSpace and the MediaType. Yes, some of these properties are RW, so they can be changed interactively in the Properties dialog. If you want to manage these classes in your application, Visual Studio can (in some cases) generate a custom managed class to do soright-click on one of the classes and choose "Generate Managed Class".

  • Management Events: This icon permits you to define events that fire based on specific WMI operations.

  • Message Queues: If Message Queuing has been installed on your system, you can use this icon to explore available message queues.

  • Performance Counters: The .NET Framework exposes a wealth of performance counters that can be used programmatically or from the Performance Monitor application to monitor the status of a wide variety of performance metrics. Unfortunately, the Server Explorer does not return the value of the performance countersit simply enumerates the counters visible at the time. Note that performance counters are created on-the-fly by applications as each instance starts. I expect to write an EBook on using and managing performance counters at a later date.

  • Services: There are a litany of services management interfaces provided by Visual Studio, SQL Server, and the Windows MMC Services console application. They all enumerate selected or all visible services installed on the targeted system. As with these other tools, the Services icon permits you to enumerate (all) visible servicesrunning or not. The icons listed under Services also show the current state of the service, as shown in Figure 4.83. Note that the SQL Server instances are shown with the instance name in parenthesis, as in SQL Server (SS2K5).

    Figure 4.83. Listing services under the "Services" icon in the Servers section of the Server Explorer.

To make managing the listed services easier, Visual Studio can generate a class to manage any selected serviceopen the Form designer, right-click on the service, and choose "Add to Designer" (as shown in Figure 4.84.) Note that this same dialog can be used to stop, start, pause, or continue some of the listed servicesand any of the SQL Server instances.

Figure 4.84. Using the Services icon to manage a selected service.


Warning

A bug in Visual Studio 2005 prevents managing a service if you add a service controller to the designer and subsequently remove it.


Once you click "Add to Designer", Visual Studio generates a class implementing a ServiceController instance to manage the service and places an icon for this class in the tool tray beneath the working Form. This class can be used to manage most aspects of the specified service. I'll discuss using the ServiceController class to manage SQL Server instances in Chapter 9.




Hitchhiker's Guide to Visual Studio and SQL Server(c) Best Practice Architectures and Examples
Hitchhikers Guide to Visual Studio and SQL Server: Best Practice Architectures and Examples, 7th Edition (Microsoft Windows Server System Series)
ISBN: 0321243625
EAN: 2147483647
Year: 2006
Pages: 227

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