Partilhar via


Instance creation using WorkflowHostingEndpoint

This topic applies to Windows Workflow Foundation 4 (WF4).

This sample demonstrates how the WorkflowHostingEndpoint can be used with WorkflowServiceHost to create workflow instances.

Demonstrates

WorkflowHostingEndpoint, WorkflowServiceHost

Discussion

This sample uses the WorkflowHostingEndpoint to create a workflow instance hosted using WorkflowServiceHost. WorkflowHostingEndpoint is an extensibility point for WorkflowServiceHost that can be used in the following scenarios:

  • Creating new workflow instances.

  • Resuming bookmarks on a workflow instance hosted in a WorkflowServiceHost.

The sample endpoint that is included exposes a contract that provides operations to create a workflow and return an instance ID, or to create an instance with a specific ID. The sample console application creates a WorkflowServiceHost instance with a basic workflow definition, and adds a CreationEndpoint to the host. It then calls the Create operation on the endpoint to create a new workflow instance.

To set up, build, and run the sample

  1. Build the solution.

  2. Run the application. The CreationEndpoint console shows a message that includes the instance ID when the workflow instance is created. The message “Hello World!” is printed by the workflow on successful resumption of the bookmark.

Ee834523.Important(en-us,VS.100).gif Note:
The samples may already be installed on your computer. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\Execution\ResumeBookmarkEndpoint

See Also

Tasks

Bookmark Resolver for WorkflowHostingEndpoint