共用方式為


SPWindowsService Class

Represents a Windows service that is installed on one or more servers in the server farm.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPersistedObject
      Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
        Microsoft.SharePoint.Administration.SPService
          Microsoft.SharePoint.Administration.SPWindowsService
            Microsoft.SharePoint.Administration.SPDatabaseService
            Microsoft.SharePoint.Administration.SPTimerService
            Microsoft.SharePoint.Search.Administration.SPSearchService

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

Syntax

<GuidAttribute("914E6AD5-6504-4691-AFEE-ABDB42520258")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPWindowsService _
    Inherits SPService

Dim instance As SPWindowsService
[GuidAttribute("914E6AD5-6504-4691-AFEE-ABDB42520258")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWindowsService : SPService

Remarks

Windows services enable you to create long-running executable applications that run in their own Windows sessions, can be automatically started when the computer starts up, can be paused and restarted, and do not show any user interface. Windows services are ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer. Windows services are the type of services listed in the Services snap-in within the Administrative Tools for a server.

To return the parent Windows service of a Windows service instance, use the inherited Service property of the SPWindowsServiceInstance class. Use the SPWindowsService constructor to return a specific Windows service that is implemented within the server farm.

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.

See Also

Reference

SPWindowsService Members

Microsoft.SharePoint.Administration Namespace