1. A document is submitted to the system in one format, and a customizable amount of processing takes place to convert it to the desired target format.
2. The choice of using workflow services for defining the conversion logic is based on two key requirements:
a. First, the conversions may be long running (taking days) or may have to incorporate data from multiple sources to proceed.
b. Second, users of the system need to be able to customize the conversion logic.
Figure 1 - Conversion Process Scenario
· Workflow Design Client
· Custom Activities
· A Client for Running Service Instances
· Various Server Components
· Sample projects that demonstrate features of Workflow Studio.
Figure 2 - The three custom activities included with the Starter Kit.
§ General Conversion: A basic project, that is similar to what is created when using the New Project function in Workflow Studio. This is shown in the Quick Start below.
§ InternalErrorSample: This project contains a workflow that has an error in the middle that is useful for seeing error messages when replaying workflows. This sample attempts to parse a string value containing a file path (provided as input) into an Int32, and throws an exception when the Assign activity that attempts the parse executes. This sample is run in a fashion similar to the Reliable Sample described in detail in the Troubleshooting with Replay section that appears later in this document, except that the instance of InternalErrorSample cannot be resumed.
§ Long Delay: This project contains a workflow that has a long delay and can be used to see how the Choose Instance to Visualize list gets updated, as well as to examine a workflow at various points in its lifecycle.
§ Reliable Sample: This project shows how to leverage AppFabric resiliency (resulting from a combination of persistence and instance management) from Workflow Studio. It is described in detail in the Troubleshooting with Replay section below.
§ SecureService: This project provides a sample service that uses activities from the Workflow Services Security Pack to secure a workflow.
§ Versioning Sample: This project provides a starting point for creating and testing the versioning functionality. Publish it as is and run it with the Document Conversion Client. Then add an Assign between the Receive and SendReply activities that changes the value of the inputFilePath variable (for example, that capitalizes it) and run it with the Document Conversion Client. Examine the web.config on the Router for the updates, as well as the VersioningSample folder contents in IIS to see how the files are versioned.
· Visual Studio 2010 RTM
· Windows Server AppFabric available for download here.
· Windows Identity Foundation (WIF)
o Download from: Windows Identity Foundation Download.
o Microsoft.IdentityModel 3.5 Installed
· Web Deploy
o Download from Web Deploy Download
o If you have VS2010 installed, you need to uninstall Web Deploy and then re-run install from download. Be sure to do a Complete installation.
o After installation, ensure that the required Windows services are running (preferably set to start automatically):
§ Web Deployment Agent Service
§ Web Management Service
· The Web Management Service must be configured to allow remote connections if you intend to connect from remote machines (this is only available on Windows Server 2008 and 2008 R2). From IIS, select the Server Node, scroll down until you see Management Service Delegation (see the following graphic). Double click it and in the pane that appears check Enable remote connections.
· IIS 6 Metabase and IIS 6 Configuration Compatibility. Open the Control Panel, and click Programs And Features. Then click Turn Windows features on or off.
1. From the directory where you extracted the starter kit files, run Setup.cmd as an administrator. (You will get three security warnings for three scripts that create databases or directories. Type “R” and press ENTER each time to run the scripts.
2. Open AppFabricApps.sln.
· Re-hosting the Workflow designer
Load activity libraries, using custom glyphs, activity designers, and the workflow debugger
· Handling WF deployment
Use WebDeploy APls for remote deployment of services
· Managing versions
Configuring a WCF routing service with Web Deploy, versioning workflow service endpoints
· Executing and controlling instances
Uses AppFabric instance control
· Reporting on instance business metrics
Implements a WCF service behavior, using promoted properties & querying for them in SQL
· Diagnostic tooling
Query SQL monitoring tables, loading monitoring tables, correlating event records with activities in the designer to provide for replay of executed workflow instances
§ Open the AppFabricApps.sln solution (from %install dir%\) and build it.
§ Run Workflow Studio by navigating to %install dir%\WorkflowStudio\bin\debug and double clicking on WorkflowStudio.exe.
§ Within Workflow Studio, select File->Open Project…
§ Browse to the General Conversion project folder under %install dir%\Workflow Studio Samples folder, select it and click OK.
§ The General Conversion workflow will load in Workflow Studio.
§ Select File->Publish Project to Server…
§ Assuming you are publishing to your local server, leave the Service URL as localhost and username/password fields blank.
§ Click OK to begin the publish operation. If you get an exception while publishing, see the Troubleshooting section above.
§ Click OK to the Publish Succeeded message box.
§ Open the Document Conversion Client (%install dir%\Client\bin\Debug\Client.exe).
§ General Conversion should be selected by default, so just click Start Conversion.
§ Verify you get a message with a file path back indicating that the conversion has started.
§ Do not click OK, keep the Document Conversion Client open.
§ Return to Workflow Studio.
§ With the GeneralConversion project still, open, select Visualization->Visualize Instance Execution…
§ The Choose Visualization Instance dialog will appear. If you get an error here, ensure that your monitoring and persistence databases are configured and named as described in the Pre-Requisites section of this document.
§ In the list, choose the latest instance. If you have multiple instances, note that the LastModifiedTime is in UTC. If your instance does not appear in the list, it may take about 10 seconds for AppFabric to update the monitoring database, click the Refresh button.
§ Click OK.
§ The designer will begin replaying the execution of the selected instance.
§ Hover over the green circles to view the additional tracking event details surfaced. The replay data is fed from tracking records stored in the AppFabric monitoring database.
§ From the Visualization menu, choose Dashboard…
§ The Dashboard will appear, summarizing all conversions performed and their average duration (on the right). Your screenshot will differ from the below depending on how many instances you have run and what conversion parameters you used. The data which feeds this dashboard is collected from promoted properties (stored in the persistence database) whose values are set by the execution of the CaptureAnalyticProperty activities in the workflow design.
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<sqlWorkflowInstanceStore connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" instanceEncodingOption="None" instanceCompletionAction="DeleteNothing" instanceLockedExceptionAction="NoRetry" />
<add name="promoteProperties" type="ServiceExtensions.PromotePropertiesBehaviorElement, ServiceExtensions, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null" />
§ In Workflow Studio, open the Reliable Service sample project.
§ Publish the project to the server.
§ As a part of the Starter Kit installation, the Default Web Site has been configured to abandon (effectively rollback to that last persist point) and suspend (wait for an administrative action before re-running) workflow service instances that have unhandled exceptions. To see this,
§ Load IIS Manager.
§ Right click on the Default Web Site and click Manage WCF and WF Services, then click Configure.
§ Click Workflow Host Management. You should see the Action on unhandled exception already set to Abandon and suspend.
§ Run the Document Conversion Client as an administrator. (%/AppFabricApps/Client/Client.exe)
§ In the list of Services, select Reliable Service.
§ Click Start Conversion. This will launch an instance of the Reliable Service with the path to the document specified in Input File Path. The problem is that this file doesn’t exist (yet)!
§ In the Conversion Started dialog, click OK.
§ Let’s see the error that resulted from our not having the file in place. Return to Workflow Studio and select Visualization->Visualize Instance Execution.
§ Select the instance just run. From the list of instances, look for the most recent instance whose LastEventStatus is Aborted.
§ Allow the replay to run, and then hover over the red circled exclamation above the Throw activity. Observe the error text.
§ Return to the Document Conversion Client, and from the Input File Path text box, copy just the file name e.g., MyFileXXXX.docx. Do not include the path.
§ Open explorer and navigate to C:\Pending
§ Create a Word Document in that folder. Name it with the file name you just copied.
§ Return to Workflow Studio.
§ From the Visualization menu choose Resume Instance Execution
§ You should see the following confirmation message:
§ The instance has now resumed, and executed successfully, which you can confirm by going back to the Visualization menu and selecting Visualize Instance Execution.
§ Click Cancel to exit the Visualization dialog, but keep Workflow Studio and the faulted replay open.
§ Another aspect of the replay feature offered by Workflow Studio is the ability to send the replay to another Workflow Studio user by creating and loading Snapshots. A Snapshot captures all of the monitoring records that drive the replay and serializes them to disk, along with the project files. Another user can load the replay file, which loads the monitoring records into a separate, private copy of the AppFabric monitoring database, and view the animated replay as if it were local.
§ On the Help menu click Create Snapshot for Support…
§ Choose a folder where you want the replay files saved:
§ Click OK to the Snapshot Created message box.
§ You now have a snapshot ready for exchange with another Workflow Studio user.
§ Run a new instance of Workflow Studio.
§ From the Help menu, choose Load Snapshot for Troubleshooting…
§ Browse to the replay folder created (it will have the name of the project).
§ Open that folder, and within it select the *.BIN file and click Open.
§ The replay will execute just as before, however this time the monitoring records were not loaded directly from the submitter’s instance of AppFabric, so the user viewing the replay does not need direct access to submitters environment in order to assist with troubleshooting.
Service Publishing Process
§ Web Deploy “synchronizes” the destination files with the source files. This means creating the IIS Web Application, and copying over new or updated files (files present on only one side are never deleted from either end).
§ In phase 2 we version the copied files by invoking a custom deployment provider called versionedPublish. In Workflow Studio the versioning strategy is file name based, where it appends the string _wfs<versionNumber>. So if Service1.xamlx was deployed, the original version will have the name Service1_wfs1.xamlx and if published again, that new one will be named Service1_wfs2.xamlx on the server.
§ Run Workflow Studio.
§ Open the SecureService sample (AppFabricApps\Workflow Studio Samples\SecureService).
§ Observe that the “Convert” operation is entirely contained within the PrincipalPermissionScope activity.
§ The Role property is set to the value “Super Users”. In the case of Windows principals, this would ensure that the caller is a member of the “Super Users” group. In the case of user name and password authentication and authorization, this requires that the user is a member of the “Super Users” role. To see what security mode is in use, right-click the web.config node in the Project tree and select Edit Security Configuration.
§ The Web.Config Security Configuration dialog appears. You can use this dialog to switch between SQL Membership and Roles for username and password credentials, Windows Authentication or None (no authentication).
§ Change the Authentication Credentials to Windows Authentication and Click OK. Workflow Studio will update the web.config of the active project.
§ Run the Document Conversion Client.
§ In the list of services, select Secure Service.
§ Click Start Conversion. This will launch an instance of the Secure Service. The problem is that this client is not in the Super Users group of Windows Authentication. You will get an error message telling you access to the service was denied. This is a confirmation that Windows Authentication is working.
1. Run ASPNET_REGSQL.EXE (ASP.NET SQL Setup Wizard) to install the needed databases to the local machine. ASPNET_REGSQL.EXE is located in the %windir%\Microsoft.NET\Framework\version folder.
2. When this Setup Wizard opens, Click Next.
3. Choose ‘Configure SQL Server for Application Purposes’ and Click Next.
4. Enter your server configuration settings and Click Next. Leaving the database set to <default> will result in this database being named aspnetdb.
5. On the following window Click Next one more time to confirm the settings and create the database. If everything goes successfully, you will see confirmation that the database was successfully created or modified. Click Finish to exit this program.
6. Next, use MSSM to execute the following three commands in order to create the user, create the role and add the user to this role in the newly created database. This user will have a username of JohnDoe and the password JD.
SQL – Create a user in the membership DB
7. Now that username and password authentication has been set up, return to Workflow Studio with the SecureService sample open.
8. Right-click the web.config node in the Project tree and click Edit Security Configuration.
9. In the Web.Config Security Configuration dialog box, select SQL Membership and Roles.
10. Set the Connection String value to “Data Source=.Data Source=.\sqlexpress;Integrated Security=SSPI;Initial Catalog=aspnetdb;”
11. Set the Membership Provider Connection String Name value to “SqlConn”
12. Set the Membership Provider Application Name value to “MembershipAndRoleProviderSample”
13. Set the Role Provider Connection String Name value to “SqlConn”
14. Set the Role Provider Application Name value to “MembershipAndRoleProviderSample”
15. Click OK and Workflow Studio will update the web.config of the SecureService sample.
16. Publish the project to the server.
17. Run the Document Conversion Client.
18. In the list of services, select Secure Service.
19. In the Authentication Credentials area at the top of the Document Conversion Client dialog box, click Username and enter “JohnDoe” for the Username value and “JD” for the password value.
20. Click Start Conversion. This will launch a new instance of the Secure Service which will attempt to communicate with the newly published version that has been configured for Username and Password Authentication. SQL Authentication should now deny access to the service. You will see a slightly different error message informing you access was denied, confirming SQL Membership and Roles is active in the service.