A method that can be used to set the start mode for a Windows Service to Automatic
, Manual
, Disabled
or Automatic (Delayed Start)
.
public static void SetStartMode(
this ServiceController serviceController,
string mode
)
serviceController
A ServiceController that references a Windows service.
mode
A string representing the service start mode.
A DICOM Listening Service (i.e., the process running Leadtools.Dicom.Server.exe
) is a windows service that processes DICOM messages.
A specific DICOM listening service (or any windows service) is configured to have a startup type:
Start mode | Description |
---|---|
Automatic |
The DICOM listening service automatically starts during the boot and logon process. |
Manual |
The DICOM listening service does not automatically start during boot and logon, but may be launched by Windows if needed. |
Disabled |
Use this setting to disable the DICOM listening service. Disabling the service prevents the service from starting. |
AutomaticDelayedStart |
Similar to Automatic, except the DICOM listening service is briefly delayed during the logon process to increase logon performance. |
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Common;
using Leadtools.Dicom.Server.Admin;
public static void Example_ServerControllerExtensions()
{
using (ServiceController sc = new ServiceController("L22_PACS_SCP64"))
{
// Set start modes using constants
sc.SetStartMode(ServiceStartModeExtended.Disabled);
sc.SetStartMode(ServiceStartModeExtended.Manual);
sc.SetStartMode(ServiceStartModeExtended.Automatic);
sc.SetStartMode(ServiceStartModeExtended.AutomaticDelayedStart);
// Set start modes using strings
sc.SetStartMode("Disabled");
sc.SetStartMode("Manual");
sc.SetStartMode("Automatic");
sc.SetStartMode("AutomaticDelayedStart");
}
}