Condividi tramite


Implementing Backup and Restore

Applies to: SharePoint Foundation 2010

Support for implementing backup and restore of Web service applications and Web service application proxies is provided in the Service Application Framework. Each service can be marked for backup independently. Services databases that do not have special requirements can be registered with SharePoint Foundation 2010. Applying the relevant backup attributes can be an alternative to implementing the IBackupRestore class.

Any complex properties that are not inherently supported by the SharePoint Foundation 2010 backup and restore infrastructure are not automatically backed up. The Service Application Framework will not participate in configuration-only backup and restore in SharePoint Foundation 2010.

Services that opt-in to backup and restore have the following resources backed up and restored automatically:

  • The persisted object.

  • Platform-level access control lists (ACLs).

  • Service endpoints.

  • The service application pool.

  • Topology service-based load balancers.

  • Databases and round robin load balancers referenced through classes derived from SPDatabase. (All other custom load balancers require custom code to be backed up and restored.)

Note

Both databases and round robin load balancers are included in backup and restore if the PersistedAttributeMergeType is set to merge. For example, a database reference marked with [Persisted] will be backed up. A database reference marked with [Persisted(PersistedAttributeMergeType.NonMerge)] will not be backed up or restored. This enables the service developer to decide if a database or load balancer must be included in the backup package. For example, it might not be necessary to back up a temporary database.

Implementing Backup and Restore

You implement backup and restore by applying a C# language attribute to the application and application proxy classes, as follows:

Apply the IisWebServiceApplicationBackupBehaviorAttribute attribute to the application class to indicate that the Web service application should be included in a backup when it occurs.

Apply the IisWebServiceApplicationProxyBackupBehaviorAttribute attribute to the application proxy class to indicate that the Web service application proxy should be included in a backup when it occurs.

Example

[IisWebServiceApplicationProxyBackupBehavior]
    [System.Runtime.InteropServices.Guid("7081FDA9-21B4-4AF6-9DCD-877348683C59")]
    internal sealed class SampleWebServiceApplicationProxy : SPIisWebServiceApplicationProxy
<IisWebServiceApplicationProxyBackupBehavior, System.Runtime.InteropServices.Guid("7081FDA9-21B4-4AF6-9DCD-877348683C59")>
Friend class SampleWebServiceApplicationProxy
        Inherits SPIisWebServiceApplicationProxy
End class

Providing an Extensibility Mechanism

If a service application or application proxy requires custom code to be executed during backup and restore, the Service Application Framework provides an extensibility mechanism that mimics the interface exposed by the SharePoint Foundation 2010 backup and restore infrastructure.

To add custom code to the backup and restore process

  1. Derive a class from the either of the following:

  2. Override one or more virtual properties or functions.

  3. Apply the custom attribute to the application or application proxy class.

Note

The only supported backup mechanism is to implement the attribute-based backup and restore mechanism. Even if you have implemented IBackupRestore and other backup and restore interfaces, you should consider using the attribute-based infrastructure. Some parts of the service application, such as the application pool that is used, cannot be re-created by using public APIs.

See Also

Reference

IBackupRestore