Condividi tramite


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

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

This topic provides instructions for how to pause, continue, start, and stop the Commerce Server Staging (CSS) service. For information about the CSS service, see Managing the CSS Service.

Note

You must have CSS administrator rights or operator rights to manage the CSS service.

To pause and continue the CSS service on the local server

  1. Open a CReplicationServer object.

  2. Initialize the server whose CSS service you want to pause by calling the CReplicationServer.Initialize method.

  3. Pause the service by using the CReplicationServer.Pause method.

  4. Wait a maximum of five minutes before you continue the service.

  5. Restart the service that is running by using the CReplicationServer.Continue method.

To start the CSS service on a remote server

  1. Open a CReplicationServer object.

  2. Initialize the server whose CSS service you want to start by calling the CReplicationServer.Initialize method.

  3. Start the service by calling the CReplicationServer.Start method.

  4. Initialize the server again by calling the CReplicationServer.Initialize method before you use the CReplicationServer object.

To stop and restart the CSS service

  1. Open a CReplicationServer object.

  2. Initialize the server whose CSS service you want to pause by calling the CReplicationServer.Initialize method.

  3. Call the CReplicationServer.Stop method to stop the service.

  4. Wait a maximum of five minutes before you continue the service.

  5. Call the CReplicationServer.Start method to restart the service.

Example

The following example pauses the CSS service and then continues it.

// 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();
  }

The following example stops the CSS service that is running on the server named Test 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("");
// Stop the CSS service
replicationServer.Stop();
// Wait for the CSS service to stop [wait a maximum of 5 minutes] 
ctrl.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 5, 0));
// Check if the CSS service is stopped and then start it.
if(ctrl.Status != ServiceControllerStatus.Stopped)
    Console.WriteLine(“Service took too long to stop.”);
else
    replicationServer.Start();

See Also

Other Resources

Managing the CSS Service

Managing CSS Servers

CReplicationServer Class

Managing the CSS Service using the Staging API