Background: Service Entities in Microsoft SharePoint Foundation
Applies to: SharePoint Foundation 2010
This topic describes the service entities in Microsoft SharePoint Foundation. These entities are modeled by the higher level classes in The Services Hierarchy of the SharePoint Foundation object model. For background information about the physical and content entities in a SharePoint Foundation deployment, see Background: Physical Objects in Microsoft SharePoint Foundation and Background: Content Entities in Microsoft SharePoint Foundation.
Applications and Services
The terms "application" and "service" in software have varying meanings; but an application is most frequently taken to be a large program that has a UI and a wide variety of functions. The common denominator of those functions can usually be expressed only with a very broad phrase such as "word processing" or "spreadsheet analysis." Also, applications provide a lot of end-to-end functionality. For example, a word processor can help an author from blank page through writing successive drafts, formatting, inserting graphics, managing reviews, and final publication of a file as, say, an XPS document. A spreadsheet application can support every stage from data insertion to mathematical-function construction and on to final report publication.
By contrast, a service provides a very narrow range of functionality that usually does not include end-to-end functions that are valuable in themselves. But the functionality that the service provides is valuable as a component part of a variety of applications. Services typically run invisibly and have little or no UI. They wait in memory until an application calls them. The Windows Print Spooler is an example of a service that can be called by any application that has to print a file.
A Windows service is any service that is hosted by the operating system and is available to locally running applications. A Web service is a service that is hosted on a network server and can be accessed by applications, such as browsers, running on remote clients. An IIS Web service is what this topic will call a Windows Communication Foundation (WCF) service that both implements the Service Application Framework of SharePoint Foundationand appears in the IIS UI as child "application" to the SharePoint Web Services IIS Web site.
Services in SharePoint Foundation
SharePoint Foundation includes several Windows services, Web services, IIS Web services, and some configuration services that do not fit into any of the first three categories.
**Web Services **
Content Publishing This service makes the data and Web pages available to browsers. It runs on the front-end Web servers and is the most important service in SharePoint Foundation. (For more information about front-end Web servers, see Background: Physical Objects in Microsoft SharePoint Foundation.)
The names of SharePoint Foundation services begin with "SharePoint", followed by the name of the kind of thing that is "served up" by the service. Thus, there is a "SharePoint Database" service and a "SharePoint Web Application" service. But remember that the former is not itself a database, it is a service providing database access. Similarly, the latter is not a Web application. It is a service providing content publishing of Web applications.
Central Administration The content of Central Administration is its own Web application so that it can have its own process and its own security policy. (For more information about Web applications, see Background: Content Entities in Microsoft SharePoint Foundation.) This Web application is supported by its own Web service also. This service ordinarily runs on a front-end Web server only in a single server deployment. In other deployments, it runs on one and only one application server. (For more information about application servers, see Background: Physical Objects in Microsoft SharePoint Foundation.)
IIS Web Services These are Windows Communication Foundation (WCF) services that implement on the Service Application Framework and one of them supports it as well. They appear in the IIS UI as child "applications" to the SharePoint Web Services IIS Web site.
Security Token This Web service supports claims-based security.
Business Data Catalog This Web service supports access to the Business Data Catalog.
Application Discovery and Load Balancer This Web service supports the Service Application Framework by enabling discovery and load balancing of configured farm-scope service instantiations (CFSIs).
Configuration Services SharePoint Foundation also provides several services that do not fit neatly into the categories of Windows service, Web service, or IIS Web service. They mainly hold configuration settings.
Diagnostics also called Tracing This service supports tracing for the Unified Logging Service (ULS). It runs on all front-end Web servers and application servers. For more information on ULS in SharePoint Foundation, see Logging For SharePoint Developers.
Incoming E-mail This service typically runs on only one application server and enables SharePoint Foundation sites to receive e-mail. Doing so can make it possible to let users add items to a list by e-mail.
Outgoing E-mail This service that typically runs on only one application server and it enables SharePoint Foundation to have e-mail functionality such as e-mail alerts when a list has changed.
Usage This service encapsulates settings for usage logging and processing in a SharePoint Foundation deployment. It runs on all front-end Web servers and application servers. Moreover, it implements the Service Application Framework, although it is not an IIS Web Service and the object that represents it at runtime is not an SPIisWebService-derived object as is the case with most of the built-in Web services that implement the framework.
Workflow Timer This service supplements the main Timer service (see below) with configuration settings for timed workflow events.
Subscription Settings This service supports site subscriptions. It has some characteristics in common with IIS Web Services inasmuch as it is a WCF Web service and the object that represents it at runtime is an SPIisWebService-derived object. However, it does not implement the Service Application Framework.
Windows Services These services appear in the list of Services in the Control Panel of the server. Because these services have a presence in the UI of SharePoint Foundation and use the object model of SharePoint Foundation, administrators and developers can start, stop, and manage the services without having to use the Control Panel.
Administration In a farm deployment, this special service is used by SharePoint Foundation to perform privileged operations on behalf of the administrator on all front-end Web servers and application servers in the farm. (This service is represented by an internal class that does not derive from SPService. It appears in the in the Services list of every front-end Web server and application server in the farm with the name "SharePoint Administration.")
Timer This service enables administrators to set jobs to run at specified times. It runs on all front-end Web servers and application servers.
Search This service enables searching the content in a SharePoint Foundation deployment. On a multiserver farm, it runs on one or more application servers.
User Code This service provides central settings for the management of the user code infrastructure in SharePoint Foundation. It runs on all front-end Web servers.
Database This is really a kind of wrapper around the already installed SQL Server Windows service. It enables the SharePoint Foundation objects to access to the content and configuration databases. In a multiserver SharePoint Foundation deployment, the server that is hosting a database is usually the only one that is running this service.
Service Application Framework
Some services implement the Service Application Framework of SharePoint Foundation. Those that do can be split into multiple configured farm-scoped instantiations (CFSIs). Each of these provides the functionality of the service but each has its own individual permission and provisioning settings. A CFSI is not an actual running process on a particular server. The same CFSI can be running on multiple servers, but it is not the same as the entirely abstract service itself either. Each of the servers on which the CFSI runs has its own actual instance (a running process) of the CFSI. Moreover, more than one CFSI of a given service can be running on the same server or servers. Thus, the framework provides a means for different versions of the same basic service to be available simultaneously. A consuming application on a front-end Web server can target a specific CFSI.
Applications that want to consume a particular CFSI of a service do so by means of proxies. The front-end Web server that hosts the application has a proxy to represent the service itself and a second proxy to represent the CFSI that is being targeted.
You can create new Windows services and Web services. For example, a Windows service that scans documents for viruses would be a nice addition to a SharePoint Foundation deployment. For more information about Windows service development, see Introduction to Windows Service Applications. See also Service Application Framework for Web service development on the Service Application Framework of SharePoint Foundation.
Every service (except the Administration Windows Service) is modeled by a class that derives from SPService and each CFSI is represented by an object from a class that derives from SPServiceApplication. Every instance of a service on a given server is modeled by a class that derives from SPServiceInstance. (The SharePoint Search service actually has two kinds of instances. One is an instance of the service itself, the other is an instance of the search index.) If the service implements the Service Application Framework, the instance can also be considered an instance of the particular CFSI. The consumer proxy for a service is represented by an SPServiceProxy object and the proxy for the CFSI is represented by an SPServiceApplicationProxy object.
Here are some concrete examples of SharePoint Foundation deployments. First, Figure 1 shows the major objects in the SharePoint Foundation object model hierarchy immediately after SharePoint Foundation is installed on a single server. Note the following in the figure:
Web services that implement the Service Application Framework are represented with a dot-bordered box. At initial installation, each has a single CFSI, sometimes called a ‘service application’.
The service proxies belong to the farm, but each CFSI proxy (also called a ‘service application proxy’) belongs to a Web application. The content publishing Web application and the Central Administration Web application each have their own proxy for the Business Data Catalog CFSI and they each have their own for the Usage and Health Data CFSI. Neither has a proxy for the Subscription or Application Discovery and Load Balancer CFSIs at initial installation.
Figure 1. Services, CFSIs, service instances, and Web applications on a new single server deployment
Figure 2 shows the services, CFSIs, and service instances on a hypothetical 10-server farm. Note the following things about this example:
The translucent rectangles represent services. These services are modeled in the SharePoint Foundation object model with SP*Service classes.
The darker translucent rectangles represent CFSIs ("service applications") that are modeled in the SharePoint Foundation object model with SP*ServiceApplication classes.
The smaller, solid rectangles represent instances of services that are modeled in the SharePoint Foundation object model with SP*ServiceInstance classes.
The Diagnostics Service does have instances running on all servers (except the dedicated database server), but the object model has no SPDiagnosticServiceInstance class (because there is no need for one in SharePoint Foundation), so there are no sold rectangles for these instances.
The Administration, Timer, Diagnostics, Application Discovery, Security Token, and Usage services run on all servers (as they must), except the dedicated database server.
Only the five front-end Web servers run the Web Application Service.
There is a dedicated search server.
There are two dedicated BDC servers.
The BDC service has two CFSIs (service applications). One has an instance on each of the dedicated BDC servers, but the other is running on just one of them. The front-end Web servers must have separate service application proxies targeting these two different CFSIs.
A fourth, multipurpose application server runs Central Administration, the e-mail services, and the subscription service. Since the Central Administration Web service hosts a Central Administration Web application, this server would have service application proxies running on it if it needed to consume any of the services that implement the Service Application Framework. This is an exception to the usual principle that consumer proxies in the framework run on front-end Web servers.
When the SharePoint Foundation databases are on a dedicated server, as in this case, SharePoint Foundation need not be installed on that server. The Database Service is just a wrapper for the SQL Server service running on the database server. Hence, SharePoint Foundation code is not running on the dedicated database server. The service and its instance appears in the figure because it is represented in the object model with the SPDatabaseService and SPDatabaseServiceInstance classes.
Figure 2. Services and service instances on a typical 10-server farm