SPWindowsServiceInstance class
代表特定伺服器執行的 Windows 服務執行個體。
Inheritance hierarchy
System.Object
Microsoft.SharePoint.Administration.SPAutoSerializingObject
Microsoft.SharePoint.Administration.SPPersistedObject
Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
Microsoft.SharePoint.Administration.SPServiceInstance
Microsoft.SharePoint.Administration.SPWindowsServiceInstance
Microsoft.SharePoint.Administration.SPLoadBalancerServiceInstance
Microsoft.SharePoint.Administration.SPTimerServiceInstance
Microsoft.SharePoint.Administration.SPTracingServiceInstance
Microsoft.SharePoint.Administration.SPUserCodeServiceInstance
Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
<GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPWindowsServiceInstance _
Inherits SPServiceInstance
'用途
Dim instance As SPWindowsServiceInstance
[GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPWindowsServiceInstance : SPServiceInstance
備註
從 [ ServiceInstances ] 或 [ Instances集合中擷取特定的 Windows 服務。
使用SPWindowsService類別繼承的Instances屬性可傳回SPServiceInstanceDependencyCollection物件,代表所有的 Windows 服務執行個體。使用SPWindowsServiceInstanceCollection建構函式會傳回目前正在執行特定伺服器的 Windows 服務執行個體的集合。
若要從集合中傳回單一的 Windows 服務執行個體使用索引器。例如,如果集合都會被指派至變數myWindowsServiceInstances,使用myWindowsServiceInstances[index]以 C# 或 Visual Basic 中的myWindowsServiceInstances(index)index所在的名稱或 GUID 的識別的 Windows 服務執行個體。索引器只適用於名稱的所有集合物件時的相同的基底類型。不過,服務執行個體集合將通常包含衍生的類別,因此,只有 GUID 可以安全地用以擷取的物件。若要依名稱擷取服務執行個體使用之集合的GetValue方法。
Thread safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.