ServiceController.ServicesDependedOn ServiceController.ServicesDependedOn ServiceController.ServicesDependedOn ServiceController.ServicesDependedOn Property

Definizione

Set di servizi da cui dipende questo servizio.The set of services that this service depends on.

public:
 property cli::array <System::ServiceProcess::ServiceController ^> ^ ServicesDependedOn { cli::array <System::ServiceProcess::ServiceController ^> ^ get(); };
[System.ServiceProcess.ServiceProcessDescription("SPServicesDependedOn")]
public System.ServiceProcess.ServiceController[] ServicesDependedOn { get; }
member this.ServicesDependedOn : System.ServiceProcess.ServiceController[]
Public ReadOnly Property ServicesDependedOn As ServiceController()

Valore della proprietà

Matrice di istanze di ServiceController, ciascuna delle quali è associata a un servizio che è necessario che sia in esecuzione affinché questo servizio lo sia.An array of ServiceController instances, each of which is associated with a service that must be running for this service to run.

Eccezioni

Si è verificato un errore durante l'accesso a un'API di sistema.An error occurred when accessing a system API.

Esempi

Nell'esempio seguente viene utilizzata ServiceController la classe per visualizzare il set di servizi da cui dipende il servizio di Messenger.The following example uses the ServiceController class to display the set of services that the Messenger service is dependent on.

ServiceController^ sc = gcnew ServiceController(  "Messenger" );
array<ServiceController^>^scServices = nullptr;
if ( sc )
{
   scServices = sc->ServicesDependedOn;
}

if ( sc && scServices )
{
   // Display the services that the Messenger service is dependent on.
   if ( scServices->Length == 0 )
   {
      Console::WriteLine(  "{0} service is not dependent on any other services.", sc->ServiceName );
   }
   else
   {
      Console::WriteLine(  "{0} service is dependent on the following:", sc->ServiceName );
      for each (ServiceController^ scTemp in scServices)
      {
         Console::WriteLine(" {0}", scTemp->DisplayName);
      }
   }
}
ServiceController sc = new ServiceController("Messenger");
ServiceController[] scServices= sc.ServicesDependedOn;

// Display the services that the Messenger service is dependent on.
if (scServices.Length == 0)
{
   Console.WriteLine("{0} service is not dependent on any other services.", 
                      sc.ServiceName);
}
else 
{
   Console.WriteLine("{0} service is dependent on the following:",
                      sc.ServiceName);

   foreach (ServiceController scTemp in scServices)
   {
      Console.WriteLine(" {0}", scTemp.DisplayName);
   }
}

Dim sc As New ServiceController("Messenger")
Dim scServices As ServiceController() = sc.ServicesDependedOn

' Display the services that the Messenger service is dependent on.
If scServices.Length = 0 Then
   Console.WriteLine("{0} service is not dependent on any other services.", sc.ServiceName)
Else
   Console.WriteLine("{0} service is dependent on the following:", sc.ServiceName)
   
   Dim scTemp As ServiceController
   For Each scTemp In  scServices
      Console.WriteLine(" {0}", scTemp.DisplayName)
   Next scTemp
End If

Commenti

Se un servizio nell' ServicesDependedOn array non è in esecuzione, non sarà possibile avviare il servizio.If any service in the ServicesDependedOn array is not running, you will not be able to start this service.

Sicurezza

ServiceControllerPermission
per la connessione ai servizi esistenti nel computer.for connecting to existing services on the computer. Enumerazione associata:BrowseAssociated enumeration: Browse

Si applica a