Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ServiceBase.CanShutdown Property

Gets or sets a value indicating whether the service should be notified when the system is shutting down.

[Visual Basic]
Public Property CanShutdown As Boolean
[C#]
public bool CanShutdown {get; set;}
[C++]
public: __property bool get_CanShutdown();
public: __property void set_CanShutdown(bool);
[JScript]
public function get CanShutdown() : Boolean;
public function set CanShutdown(Boolean);

Property Value

true if the service should be notified when the system is shutting down; otherwise, false.

Exceptions

Exception Type Condition
InvalidOperationException The service has already been started. The CanShutdown property cannot be changed once the service has started.

Remarks

If CanShutdown is true, the service is notified when the system is shutting down. At shutdown, the OnShutdown method is called if it has been implemented in your derived class.

Note   Only the system should cause the OnShutdown method to execute; the service can call it, but this is not recommended.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ServiceBase Class | ServiceBase Members | System.ServiceProcess Namespace | OnShutdown | CanPauseAndContinue | CanStop | CanHandlePowerEvent

Show:
© 2015 Microsoft