_____ From: Mike Belcher [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 4:09 PM To: '[email protected]' Subject: Controlling windows services with asp.net and ServiceController class I have a page that I use to access and control a windows service. I noticed when I am in the services.mmc in windows administration tools that I have the option to RESTART the service but if you look at the members of the ServiceController class I see nothing about restarting a service. How can I restart a service to like in services.mmc? Basically it would be like closing a program And re opening it. .NET Framework Class Library ServiceController Members ServiceController <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasstopic.asp> overview Public Constructors public constructorServiceController <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassctortopic.asp> Constructor Overloaded. Initializes a new instance of the ServiceController class. Public Properties public propertyCanPauseAndContinue <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasscanpauseandcontinuetopic.asp> Gets a value indicating whether the service can be paused and resumed. public propertyCanShutdown <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasscanshutdowntopic.asp> Gets a value indicating whether the service should be notified when the system is shutting down. public propertyCanStop <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasscanstoptopic.asp> Gets a value indicating whether the service can be stopped after it has started. public propertyContainer <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasscontainertopic.asp> (inherited from Component) Gets the IContainer <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode licontainerclasstopic.asp> that contains the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> . public propertyDependentServices <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassdependentservicestopic.asp> Gets the set of services that depends on the service associated with this ServiceController instance. public propertyDisplayName <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassdisplaynametopic.asp> Gets or sets a friendly name for the service. public propertyMachineName <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassmachinenametopic.asp> Gets or sets the name of the computer on which this service resides. public propertyServiceName <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassservicenametopic.asp> Gets or sets the name that identifies the service that this instance references. public propertyServicesDependedOn <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassservicesdependedontopic.asp> The set of services that this service depends on. public propertyServiceType <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassservicetypetopic.asp> Gets the type of service that this object references. public propertySite <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasssitetopic.asp> (inherited from Component) Gets or sets the ISite <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lisiteclasstopic.asp> of the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> . public propertyStatus <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassstatustopic.asp> Gets the status of the service that is referenced by this instance. Public Methods public methodClose <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassclosetopic.asp> Disconnects this ServiceController instance from the service and frees all the resources that the instance allocated. public methodContinue <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasscontinuetopic.asp> Continues a service after it has been paused. public methodCreateObjRef <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemmarshalbyrefo bjectclasscreateobjreftopic.asp> (inherited from MarshalByRefObject) Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. public methodDispose <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassdisposetopic.asp> (inherited from Component) Overloaded. Releases the resources used by the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> . public methodEquals <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclasseq ualstopic.asp> (inherited from Object) Overloaded. Determines whether two Object <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassto pic.asp> instances are equal. public methodExecuteCommand <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassexecutecommandtopic.asp> Executes a custom command on the service. public methodstatic (Shared in Visual Basic)GetDevices <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassgetdevicestopic.asp> Overloaded. Retrieves the device driver services on a computer. public methodGetHashCode <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassge thashcodetopic.asp> (inherited from Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. public methodGetLifetimeService <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemmarshalbyrefo bjectclassgetlifetimeservicetopic.asp> (inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the lifetime policy for this instance. public methodstatic (Shared in Visual Basic)GetServices <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassgetservicestopic.asp> Overloaded. Retrieves the non-device driver services on a computer, and those that are not drivers. public methodGetType <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassge ttypetopic.asp> (inherited from Object) Gets the Type <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemtypeclasstopi c.asp> of the current instance. public methodInitializeLifetimeService <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemmarshalbyrefo bjectclassinitializelifetimeservicetopic.asp> (inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for this instance. public methodPause <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasspausetopic.asp> Suspends a service's operation. public methodRefresh <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassrefreshtopic.asp> Refreshes all the property values, setting them to the current values. public methodStart <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassstarttopic.asp> Overloaded. Starts the service. public methodStop <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassstoptopic.asp> Stops this service and any services that are dependent on this service. public methodToString <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassto stringtopic.asp> (inherited from Object) Returns a String <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemstringclassto pic.asp> that represents the current Object <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassto pic.asp> . public methodWaitForStatus <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasswaitforstatustopic.asp> Overloaded. Waits for the service to reach the specified status. Public Events public eventDisposed <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassdisposedtopic.asp> (inherited from Component) Adds an event handler to listen to the Disposed <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassdisposedtopic.asp> event on the component. Protected Properties protected propertyDesignMode <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassdesignmodetopic.asp> (inherited from Component) Gets a value that indicates whether the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> is currently in design mode. protected propertyEvents <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasseventstopic.asp> (inherited from Component) Gets the list of event handlers that are attached to this Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> . Protected Methods protected methodDispose <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclassdisposetopic.asp> Overloaded. Overridden. See Component.Dispose <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassdisposetopic.asp> . protected methodFinalize <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassfinalizetopic.asp> (inherited from Component) Overridden. Releases unmanaged resources and performs other cleanup operations before the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> is reclaimed by garbage collection. In C# and C++, finalizers are expressed using destructor syntax. protected methodGetService <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclassgetservicetopic.asp> (inherited from Component) Returns an object that represents a service provided by the Component <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcomponentclasstopic.asp> or by its Container <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemcomponentmode lcontainerclasstopic.asp> . protected methodMemberwiseClone <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassme mberwiseclonetopic.asp> (inherited from Object) Creates a shallow copy of the current Object <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemobjectclassto pic.asp> . See Also ServiceController <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces sservicecontrollerclasstopic.asp> Class | System.ServiceProcess <http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemserviceproces s.asp> Namespace | Framework <http://msdn.microsoft.com/library/en-us/vbcon/html/vxoriFrameworkServicesNa mespaces.asp> Services Namespaces in Visual Studio | Windows <http://msdn.microsoft.com/library/en-us/vbcon/html/vxoriRichClient-SideGUIN amespaces.asp> Applications Namespaces in Visual Studio | Managed <http://msdn.microsoft.com/library/en-us/vcmex/html/vcconMCOverview.asp> Extensions for C++ Programming [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h3nbb0e/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123798214/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
