다음을 통해 공유


Individual File Replications

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Commerce Server Staging (CSS) Web content projects operate on whole directories. To send or delete several files on demand, you use the CReplicationClient object. This object provides more detailed control over the replication process and, because it is single-file based, provides much more detailed error reporting through the CReplicationClientError object.

Note

The CReplicationClient object can only be used to replicate or copy files from one server to another. It cannot be used to replicate files associated with an IIS metabase or business data project.

The concepts that you use when you replicate individual files are summarized in the following sections:

  • Project Context

  • File Replication Operations

  • Connectionless and Connection Mode

  • Transaction Processing and File Replication Commit Requirements

  • Initiating File Replication

  • Retrieving File Replication Errors

Project Context

Individual file replications reference an existing Web content project for their context. The project context provides the following information to support the replication of individual files:

  • Destination. Specifies the destination servers where files are to be transmitted.

  • LocalDirectory. Specifies the source directory whose files are to be replicated and the endpoint directory where files are transmitted.

  • MapUrl. Specifies the URL to which the destination maps.

  • SkipLockedFiles. Specifies whether CSS will skip the replication of files locked on the source or overwrite a file on the target if it is locked or currently being used.

  • TransactionMethod. Specifies whether to enable transactional staging on the endpoint server. This property can be enabled for a Web content project or for an endpoint server.

  • IIS virtual directory:

    • CreateVirtualRoot. Specifies whether the Web content project is to stage to a virtual root directory.

    • VRootWebSiteName. Specifies the relative path of the physical directory to be mapped for the virtual directory of the Web site defined for the project.

    • VRootAttributes. Specifies the user rights that are set on the virtual directory.

The following project properties are not used during individual file replication:

  • AfterReceiveScript, AfterSendScript, BeforeReceiveScript, and BeforeSendScript. Specifies the path and file name of pre and post processing scripts.

  • MailTo, MailToFail, MailToSuccess. Specifies where to send e-mail messages when a project succeeds or fails.

  • ExcludeDir. Specifies a directory to exclude from replication.

  • Filter. Specifies one or more filters that can be used to include or exclude a file or directory, apply a filter to a directory, apply a filter to all subdirectories.

  • Flags. Specifies a bitmask that defines how the Web content files should be replicated.

File Replication Operations

You use one of the following methods to perform individual file replication operations:

  • DeleteFile. Deletes a file on each destination server that is defined for the project.

  • SendFile. Sends a file to each destination server that is defined for the project.

  • SendFiles. Sends an array of files to each destination server that is defined for the project.

Connectionless and Connection Mode

Individual files can be replicated in one of two modes: connectionless and connection.

In connectionless mode, the individual file replication methods DeleteFile, SendFile, and SendFiles perform their own connections to each destination server. That is, they transparently connect to each destination server, perform the operation, and then disconnect from the destination servers. This mode is useful when you send or delete only a few files to a few servers.

To minimize the time requirements when you connect and disconnect to each server when you send or delete several files, you should establish the connection mode. You use the Connect method to initiate a connection for each destination that is defined for the project. As soon as it is called, the CReplicationClient object is in connection mode. After the file replication finishes, the Disconnect method is used to disconnect from each destination that is defined for the project.

Transaction Processing and File Replication Commit Requirements

If you perform file replications in connection mode and transaction processing is turned on at an endpoint server (TransactionMethod=YES), the file transactions are not applied until you call the Commit method. You should call this method before you call the Disconnect method to sever the connections to the endpoint servers.

If you perform file replications in connectionless mode, the file changes are made automatically when they are finished and you do not have to call the Commit method.

Initiating File Replication

There are two methods that you can use to initiate individual file replication:

You can issue an Abort method while a CReplicationClient object is active and in connection mode to cancel all pending transactions. The Abort method has no affect if file replication is performed in connectionless mode.

For more information about how to initiate file replication, see How to Replicate Individual Files.

Retrieving File Replication Errors

When an error occurs during individual file replication, a CReplicationClientError object is created, one for each destination server that is defined for the project. You access the array of CReplicationClientError objects by calling the CReplicationClient.GetExtendedErrorInfo method. This array is empty when no error information is available, that is when the individual file replication operations completed without an error.

For more information about how to retrieve file replication errors, see How to Retrieve Individual File Replication Errors.

See Also

Other Resources

Projects

How to Replicate Individual Files

How to Retrieve Individual File Replication Errors

CReplicationClient Class

CReplicationClient Class