Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This topic applies to Windows Workflow Foundation 4 (WF4).
The WorkflowUnhandledExceptionBehavior is a behavior that enables you to specify the action to take if an unhandled exception occurs within a workflow hosted in WorkflowServiceHost. This topic shows how to configure this behavior in a configuration file.
To configure WorkflowUnhandledExceptionBehavior
Add a <workflowUnhandledException> element in a <behavior> element within a <serviceBehaviors> element, using the action attribute to specify the action to take when an unhandled exception occurs as shown in the following example.
<behaviors> <serviceBehaviors> <behavior name=""> <workflowUnhandledException action="abandonAndSuspend"/> </behavior> </serviceBehaviors> </behaviors>
Note
The preceding configuration sample is using simplified configuration. For more information, see Simplified Configuration.
This behavior can be configured in code as shown in the following example.
host.Description.Behaviors.Add(new WorkflowUnhandledExceptionBehavior { Action = WorkflowUnhandledExceptionAction.AbandonAndSuspend });
The action attribute of the <workflowUnhandledException> element can be set to one of the following values:
- abandon
Aborts the instance in memory without touching the persisted instance state (that is, roll back to the last persist point).
- abandonAndSuspend
Aborts the instance in memory and updates the persisted instance to be suspended.
- cancel
Calls cancellation handlers for the instance and then completes the instance in memory, which may also remove it from the instance store
- terminate
Completes the instance in memory and removes it from the instance store.
For more information about WorkflowUnhandledExceptionBehavior, see Workflow Service Host Extensibility.
- abandon
See Also
Concepts
Workflow Service Host Extensibility