共用方式為


SPServiceInstance class

代表單一執行個體的伺服器執行的服務。

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPersistedObject
      Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
        Microsoft.SharePoint.Administration.SPServiceInstance
          

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
<GuidAttribute("983C4B09-FBC0-4f4b-92BC-42FABF556ED5")> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPServiceInstance _
    Inherits SPPersistedUpgradableObject
'用途
Dim instance As SPServiceInstance
[GuidAttribute("983C4B09-FBC0-4f4b-92BC-42FABF556ED5")]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPServiceInstance : SPPersistedUpgradableObject

備註

SPServiceInstance類別會將服務與伺服器產生關聯。使用Service屬性來取得SPService物件,其中包含套用至服務的執行個體實作的全伺服器陣列設定。使用Server屬性來取得SPServer物件已安裝的這個執行個體。

若要傳回SPServiceInstanceCollection物件,代表目前在伺服器執行的服務執行個體,請使用ServiceInstancesSPServer類別屬性,或是SPServiceInstanceCollection建構函式。若要傳回SPServiceInstanceDependencyCollection物件,代表依存服務的服務執行個體,請使用SPService類別之Instances屬性。

若要從集合中傳回單一服務執行個體使用索引器。例如,如果集合都會被指派至變數myServiceInstances,使用myServiceInstances[index]以 C# 或 Visual Basic 中的myServiceInstances(index)index所在的名稱或 GUID 的識別服務執行個體。索引器只適用於名稱的所有集合物件時的相同的基底類型。不過,服務執行個體集合將通常包含衍生的類別,因此,只有 GUID 可以安全地用以擷取的物件。若要依名稱擷取服務執行個體使用SPPersistedObjectCollection<T>類別之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.

請參閱

參照

SPServiceInstance members

Microsoft.SharePoint.Administration namespace

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPersistedObject
      Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
        Microsoft.SharePoint.Administration.SPServiceInstance
          Microsoft.SharePoint.Administration.SPDatabaseServiceInstance
          Microsoft.SharePoint.Administration.SPIisWebServiceInstance
          Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance
          Microsoft.SharePoint.Administration.SPOutboundMailServiceInstance
          Microsoft.SharePoint.Administration.SPRequestManagementServiceInstance
          Microsoft.SharePoint.Administration.SPUsageServiceInstance
          Microsoft.SharePoint.Administration.SPWebServiceInstance
          Microsoft.SharePoint.Administration.SPWindowsServiceInstance