Creating Service Application Framework Web Services
Last modified: April 20, 2010
Applies to: SharePoint Foundation 2010
Service Application Framework resources, such as databases, can take time to bring online. For efficiency, the process of creating a service object and bringing it to the online and usable state is split into two phases: object creation and object provisioning (or simply provisioning).
In the object creation phase, the information that is required to create the server resources is collected and stored as settings on a configuration object, such as in a class derived from SPServiceApplication. For example, the server farm administrator may use a page in the Central Administration site to specify a new service application name, and to specify the location of the server running Microsoft SQL Server where the service application database should be created.
The object creation phase is typically run synchronously in the same process where the user input is acquired, for example, in the Central Administration application pool process.
No long-running operations are performed in the object creation phase. User input is only collected and stored in a configuration object.
At the end of the object creation phase, the SPObjectStatus configuration object is typically set to SPObjectStatus::Provisioning.
In the provisioning phase, the configuration object settings are read from the configuration database and used to create and initialize the service resources.
This phase is often run asynchronously in another process or even on a different server, for example, in a timer job, instead of on a user interface thread where it could be more easily aborted.
The provisioning code and the object creation code can run on different servers. Therefore, it is important to first write the settings to a configuration object, and then call the Update method in the object creation phase before the provisioning phase begins.
At the end of the provisioning phase, the status of the configuration object is typically set to SPObjectStatus::Online.