PRB: ICOMAdminCatalog2::PauseApplicationInstances Returns S_OK for Applications That Are Not Running (305765)



The information in this article applies to:

  • Microsoft COM+ 1.5

This article was previously published under Q305765

SYMPTOMS

The ICOMAdminCatalog2::PauseApplicationInstances method returns S_OK for applications that are not running instead of COMADMIN_E_APP_NOT_RUNNING.

RESOLUTION

To resolve this problem, pass an empty ApplicationInstances collection to PauseApplicationInstances. In this scenario, PauseApplicationInstances successfully pauses all zero elements and returns without error.

STATUS

This behavior is by design.

MORE INFORMATION

The following code reproduces this problem when you update the call
if (objApplications.Item(lIndex).Value('Name') == 'MyApplication')
				
so that it points to the name of one of your applications.
var objComAdmin = null;
var objApplications = null;
var objApplication = null;
var objAppInst = null;

objComAdmin = new ActiveXObject('ComAdmin.ComAdminCatalog');

objApplications = objComAdmin.GetCollection('Applications');
objApplications.Populate();

WScript.Echo(objApplications.Count);

for (lIndex = 0; lIndex < objApplications.Count; ++lIndex)
{
  if (objApplications.Item(lIndex).Value('Name') == 'MyApplication')
  {
    objApplication = objApplications.Item(lIndex);
    objAppInst = objApplications.GetCollection('ApplicationInstances', objApplication.Key)

    if (objAppInst == null)
      WScript.Echo("No application instances");
    else
    {
      objAppInst.Populate();
      WScript.Echo("There are " + objAppInst.Count + " instances");
    }

    try
    {
      objComAdmin.PauseApplicationInstances(objAppInst);
    }
    catch(ex)
    {
      WScript.Echo("Error!");
    }

    WScript.Echo("OK");
    WScript.Quit(0);
  }
}
				

Modification Type:MajorLast Reviewed:2/20/2002
Keywords:kbprb kbSysAdmin KB305765