Share via


Configure Workflow Host Management Using Windows Server AppFabric Cmdlets

This topic describes how to configure hosting-related features by using AppFabric Windows PowerShell cmdlets.

To configure the Instance Unload feature by using cmdlets

This section describes how to use AppFabric cmdlets to get, set, or clear configuration elements and attributes related to the Instance Unload feature in the configuration file associated with the specified scope. The Instance Unload feature allows you to specify whether and when the workflow service instances are persisted and unloaded.

Cmdlet

Description

Get-ASInstanceUnloadPolicy

Gets the values of the timeToUnload and timeToPersist attributes of the workflowIdle element in the configuration file associated with the specified scope.

Set-ASInstanceUnloadPolicy

Sets the values of the timeToUnload and timeToPersist attributes of the workflowIdle element in the configuration file associated with the specified scope. If the workflowIdle element does not exist, the cmdlet adds the element and sets the values of the timeToUnload and timeToPersist attributes on the element. If you pass only one of these two parameters, the attribute corresponding to other parameter is set to 00:00:00.

Clear-ASInstanceUnloadPolicy

Removes the workflowIdle element from the configuration file associated with the specified scope.

Syntax options for the Get-ASInstanceUnloadPolicy cmdlet

// to get instance unload policy settings at the root level
Get-ASInstanceUnloadPolicy -Root

// to get instance unload policy settings at the Web site level
Get-ASInstanceUnloadPolicy -SiteName <String> 

// to get instance unload policy settings at the virtual application or service level that the VirtualPath points to 
Get-ASInstanceUnloadPolicy -SiteName <String> -VirtualPath <String>] 

// to get instance unload policy settings at the site, virtual application or service level that the Uri points to
Get- ASInstanceUnloadPolicy -Uri <Uri> 

// to get instance unload policy settings at the application level specified by the ApplicationObject.
Get-ASInstanceUnloadPolicy -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Get-ASInstanceUnloadPolicy

// to get instance unload policy settings at the service level specified by the Service Object
Get-ASInstanceUnloadPolicy -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Get-ASInstanceUnloadPolicy

Syntax options for the Set-ASInstanceUnloadPolicy cmdlet

Set-ASInstanceUnloadPolicy –Root –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Set-ASInstanceUnloadPolicy -SiteName <String> –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Set-ASInstanceUnloadPolicy -SiteName <String> -VirtualPath <string> –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Set-ASInstanceUnloadPolicy –Uri <Uri> –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Set-ASInstanceUnloadPolicy –ApplicationObject <ApplicationInfo> –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Set-ASInstanceUnloadPolicy –ServiceObject <ServiceInfo> –TimeToPersist <TimeSpan> -TimeToUnload <TimeSpan>

Parameters specific to the Set-ASInstanceUnloadPolicy cmdlet

Parameter

Description

TimeToUnload

Specifies how long a service host should wait before unloading a workflow service instance after the instance becomes idle.

TimeToPersist

Specifies how long a service host should wait before persisting a workflow service instance after the instance becomes idle.

Note

You only need to pass the parameter that you want to change. For example, if you want to set a value for the timeToUnload attribute, then pass only the TimeToUnload parameter.

Syntax options for the Clear-ASInstanceUnloadPolicy cmdlet

Clear-ASInstanceUnloadPolicy -Root

Clear-ASInstanceUnloadPolicy -SiteName <String> 

Clear-ASInstanceUnloadPolicy -SiteName <String> -VirtualPath <String>] 

Clear- ASInstanceUnloadPolicy -Uri <Uri> 

Clear-ASInstanceUnloadPolicy -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Clear-ASInstanceUnloadPolicy

Clear-ASInstanceUnloadPolicy -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Clear-ASInstanceUnloadPolicy

To configure the Instance Exception Policy by using cmdlets

You can use the following cmdlets:

Cmdlet

Description

Get-ASInstanceExceptionPolicy

Gets the value of the action attribute of the workflowUnhandledException from the configuration file associated with the specified scope.

Set-ASInstanceExceptionPolicy

Sets the value of the action attribute of the workflowUnhandledException in the configuration file associated with the specified scope. The cmdlet creates the element if the element does not exist already and then sets the action attribute on the element.

Clear-ASInstanceExceptionPolicy

Removes the workflowUnhandledException element from the configuration file associated with the specified scope.

Syntax options for the Get-ASInstanceExceptionPolicy cmdlet

// to get instance exception policy settings at the root level
Get-ASInstanceExceptionPolicy -Root

// to get instance exception policy settings at the Web site level
Get-ASInstanceExceptionPolicy -SiteName <String> 

// to get instance exception policy settings at the virtual application or service level that the VirtualPath points to 
Get-ASInstanceExceptionPolicy -SiteName <String> -VirtualPath <String>] 

// to get instance exception policy settings at the site, virtual application or service level that the Uri points to
Get-ASInstanceExceptionPolicy -Uri <Uri> 

// to get instance exception policy settings at the application level specified by the ApplicationObject.
Get-ASInstanceExceptionPolicy -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Get-ASInstanceExceptionPolicy

// to get instance exception policy settings at the service level specified by the Service Object
Get-ASInstanceExceptionPolicy -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Get-ASInstanceExceptionPolicy

Warning

The IIS Manager displays AbandonAndSuspend as a value for this field if there is no associated workflowUnhandledException element in the configuration file associated with the specified scope. However, this cmdlet returns no value if there is no workflowUnhandledException element in the configuration file associated with the specified scope.

Syntax options for the Set-ASInstanceExceptionPolicy cmdlet

Set-ASInstanceExceptionPolicy –Root –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Set-ASInstanceExceptionPolicy -SiteName <String> –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Set-ASInstanceExceptionPolicy -SiteName <String> -VirtualPath <string> –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Set-ASInstanceExceptionPolicy –Uri <Uri> –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Set-ASInstanceExceptionPolicy –ApplicationObject <ApplicationInfo> –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Set-ASInstanceExceptionPolicy –ServiceObject <ServiceInfo> –Action {Abandon | AbandonAndSuspend | Cancel | Terminate}

Parameters specific to the Set-ASInstanceExceptionPolicy cmdlet

Parameter

Description

Action

Specifies what action a service host should perform when a workflow service instance it runs experiences an unhandled exception.

  • Abandon. The service host aborts the workflow service instance in memory. The state of the instance in the database remains “Active”. The Workflow Management Service recovers the abandoned workflow service instance from the last persistence point saved in the persistence database.

  • Abandon and suspend. The service host aborts the workflow service instance in memory and sets the state of the instance in the persistence database to “Suspended”. A suspended workflow service instance can be resumed or terminated later by using IIS Manager. These workflow service instances are not recovered by the Workflow Management Service automatically.

  • Terminate. The service host aborts the workflow service instance in memory, and sets the state of the instance in the persistence database to “Completed (Terminated)”. A terminated workflow service instance cannot be resumed later.

  • Cancel. The service host cancels the workflow service instance causing all the cancellation handlers to be invoked so that a workflow terminates in a graceful manner, and sets the state of the instance in the persistence database to “Completed (Cancelled)”.

Syntax options for the Clear-ASInstanceExceptionPolicy cmdlet

Clear-ASInstanceExceptionPolicy -Root

Clear-ASInstanceExceptionPolicy -SiteName <String> 

Clear-ASInstanceExceptionPolicy -SiteName <String> -VirtualPath <String>] 

Clear-ASInstanceExceptionPolicy -Uri <Uri> 

Clear-ASInstanceExceptionPolicy -ApplicationObject <ApplicationInfo> 

Clear-ASInstanceExceptionPolicy -ServiceObject <ServiceInfo> 

To configure the Instance Management Policy by using cmdlets

You can use the following cmdlets:

Cmdlet

Description

Get-ASInstanceManagement

Gets the value of the authorizedWindowsGroup attribute of the workflowInstanceManagement element from the configuration file associated with the specified scope.

Set-ASInstanceManagement

Sets the value of the authorizedWindowsGroup attribute of the workflowInstanceManagement element in the configuration file associated with the specified scope. The cmdlet creates the element if the element does not exist already and then sets the action attribute on the element.

Clear-ASInstanceManagement

Removes the workflowInstanceManagement element from the configuration file associated with the specified scope. The cmdlet also adds <remove name="workflowInstanceManagement" /> to the configuration file.

Syntax options for the Get-ASInstanceManagement cmdlet

// to get instance management policy settings at the root level
Get-ASInstanceManagement -Root

// to get instance management policy settings at the Web site level
Get-ASInstanceManagement -SiteName <String> 

// to get instance management policy settings at the virtual application or service level that the VirtualPath points to 
Get-ASInstanceManagement -SiteName <String> -VirtualPath <String>] 

// to get instance management policy settings at the site, virtual application or service level that the Uri points to
Get-ASInstanceManagement -Uri <Uri> 

// to get instance management policy settings at the application level specified by the ApplicationObject.
Get-ASInstanceManagement -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Get-ASInstanceManagement

// to get instance management policy settings at the service level specified by the Service Object
Get-ASInstanceManagement -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Get-ASInstanceManagement

Syntax options for the Set-ASInstanceManagement cmdlet

Set-ASInstanceManagement –Root –AuthorizedWindowsGroup <String>}

Set-ASInstanceManagement -SiteName <String> –AuthorizedWindowsGroup <String>}

Set-ASInstanceManagement -SiteName <String> -Virtual Path <String> –AuthorizedWindowsGroup <String>}
Set-ASInstanceManagement -SiteName <String> -Virtual Path <String> –Root –EnableNetPipeProtocol
Set-ASInstanceManagement -SiteName <String> -Virtual Path <String> –AuthorizedWindowsGroup <String>} –Root –EnableNetPipeProtocol

Set-ASInstanceManagement –Uri <Uri> –AuthorizedWindowsGroup <String>}

Set-ASInstanceManagement –ApplicationObject <ApplicationInfo> –AuthorizedWindowsGroup <String>}

Set-ASInstanceManagement –ServiceObject <ServiceInfo> –AuthorizedWindowsGroup <String>}

Syntax options for the Clear-ASInstanceManagement cmdlet

Clear-ASInstanceManagement -Root

Clear-ASInstanceManagement -SiteName <String> 

Clear-ASInstanceManagement -SiteName <String> -VirtualPath <String>] 

Clear-ASInstanceManagement -Uri <Uri> 

Clear-ASInstanceManagement -ApplicationObject <ApplicationInfo> 

Clear-ASInstanceManagement -ServiceObject <ServiceInfo>