次の方法で共有


CReplicationServer.Pause Method

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

Pauses the Commerce Server Staging (CSS) service on a server.

void Pause()

Remarks

You must have CSS administrator permissions to call this method.

When you use the Pause method, the CSS service rejects any requests to start a new replication. However, it does not stop any currently running replications. You should pause the CSS service before stopping the service. When you pause the CSS service, the service will stay paused until you call the Continue method. If you attempt to deploy a project to or from a paused server, you will receive an error message.

After pausing the CSS service, wait five minutes before continuing the service to make sure that the CSS service is in the paused state.

The CReplicationServer.Pause method corresponds to the COM method named ReplicationServer.Pause.

Example

The following example pauses the CSS service, and then restarts it.

#using System.ServiceProcess; // Defined in assembly System.Serviceprocess.dll
// Initialize a service controller to get information on the state of the CSS service
ServiceController ctrl = new ServiceController("Commerce Server Staging");
CReplicationServer replicationServer = new CReplicationServer();
  replicationServer.Initialize("");
// pause service
replicationServer.Pause();
// Wait for the CSS service to pause [wait a maximum of 5 minutes] 
ctrl.WaitForStatus(ServiceControllerStatus.Paused, new TimeSpan(0, 5, 0));
// check if the CSS service is paused.
if(ctrl.Status != ServiceControllerStatus.Paused)
       Console.WriteLine("Service took too long to pause.");
else
  {
    // ...
    replicationServer.Continue();
  }

Compiling the Code

You must add a using directive for the System.ServiceProcesses namespace to run this sample.

See Also

Other Resources

Managing the CSS Service

How to Pause, Continue, Start, and Stop the CSS Service

CReplicationServer.Continue Method

CReplicationServer.Stop Method

CReplicationServer Class