ServiceBase.RequestAdditionalTime Method

Definition

Overloads

RequestAdditionalTime(Int32)

Requests additional time for a pending operation.

RequestAdditionalTime(TimeSpan)

When this method is called from OnStart, OnStop, OnPause or OnContinue, the specified wait hint is passed to the Service Control Manager to avoid having the service marked as not responding.

RequestAdditionalTime(Int32)

Source:
ServiceBase.cs
Source:
ServiceBase.cs
Source:
ServiceBase.cs

Requests additional time for a pending operation.

C#
public void RequestAdditionalTime(int milliseconds);
C#
[System.Runtime.InteropServices.ComVisible(false)]
public void RequestAdditionalTime(int milliseconds);

Parameters

milliseconds
Int32

The requested time in milliseconds.

Attributes

Exceptions

The service is not in a pending state.

Remarks

The RequestAdditionalTime method is intended to be called by the overridden OnContinue, OnPause, OnStart, or OnStop methods to request additional time for a pending operation, to prevent the Service Control Manager (SCM) from marking the service as not responding. If the pending operation is not a continue, pause, start, or stop, an InvalidOperationException is thrown.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

RequestAdditionalTime(TimeSpan)

Source:
ServiceBase.cs
Source:
ServiceBase.cs
Source:
ServiceBase.cs

When this method is called from OnStart, OnStop, OnPause or OnContinue, the specified wait hint is passed to the Service Control Manager to avoid having the service marked as not responding.

C#
public void RequestAdditionalTime(TimeSpan time);

Parameters

time
TimeSpan

The requested additional time.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)