Windows Workflow Foundation (WF4) - Workflow Services and Auto-Start

This sample application demonstrates how you can create a Workflow Service that will automatically start and periodically wake up to do some work. The sample also demonstrates a UI that shows the progress of the work and provides control and query capabilities.

C# (249.0 KB)
 
 
 
 
 
(6)
3,367 times
Add to favorites
4/28/2011
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Long running activity
    3 Posts | Last post May 30, 2012
    • Hi Ron, great blog and great examples! 
      
      I have some questions about your example... Lets imagine that instead of just counting and sleeping in main work brunch we do some "real" job and activity that doing the job takes some time for execution (lets say couple minutes). What will happen in this case? Will it be possible to get access to Query branch when the activity is working? Or it will will be blocked because of one thread? What if activity is asynchronous, will your example continue working? What is your suggestion if it's necessary to do some long running activities in the loop and control the number of that amount of job already done (some king of progress bar)?
    • If your worker activities are I/O bound rather than CPU bound be sure to build them using AsyncCodeActivity.  This will allow the workflow to access the Query branch even when work is going on.  Another option would be to simply call a service (using Async calls) that sends the work somewhere else.  Be sure to take a look at the blog series I wrote on WF4 and Task Parallelism (http://blogs.msdn.com/b/rjacobs/archive/2011/06/28/the-workflow-parallel-activity-and-task-parallelism.aspx) for more.
    • Thanks, Ron. I just tried asynchronous activity and it works well.
  • Can we have more than one xamlx in one project?
    2 Posts | Last post February 07, 2012
    • If we can have more than one xamlx in one project, how do we set up the web.config to make the other xamlx available?
    • XAMLX files are like .ASPX files.  You don't have to have seperate config entries for them.  You can have as many as you like.  The XAMLX Workflow Service does have a configuration name property if you want to set this in order to use a <service> tag in the config file.
  • Which account should I add to a folder (grant a permissions)
    3 Posts | Last post January 05, 2012
    • I try to modify the TraceBatchWork.cs to call my function to write a file to a folder. I get an "UnauthorizedAccessException" for "Access to the path is denied". So I grant a full permissions for IUSR  and ASP .NET to the folder, but I still get an exception. Under the IIS Authentication, I saw the Anonymous Authentication is Enabled and the Specific user is "IUSR". Is there other account i should add to the folder?
    • Try NETWORK SERVICE
    • Ron Thank you for your help. I find my problem, it is due to my application pool identities is ASP.NET v4.0 instead of DefaultAppPool. It work once I add the ASP.NET v4.0 to the Security of the folder. Please see the following link : http://learn.iis.net/page.aspx/624/application-pool-identities/
      
  • Does not update the App Fabric Monitoring DB
    9 Posts | Last post December 23, 2011
    • I can run the WEBBatch from my computer and it had updated the AppFabricMonitoringDB on the first day I run the program. Also I can see three autostart batch job running. However, today I start the program from the VS2010, I can Submit Batch and it will show up on the Submitted Jobs gridview. But it don't show up on the other two gridview and not update the AppFabricMonitoringDB. Am I broke the connections string? 
    • Just curious are you using AppFabric 1.0 or 1.1?
    • I look at my Web Platform Installer 3.0 to find out that my Windows Server AppFabric Released on 7/23/2010, since I install the AppFabric through the Web Platform Installer. Other than that I cannot find any version number from the App. Would you mind to point me where I can find the Version number.
    • Ok After I double click on it, It said the version is 1.0.2034.2
    • I see the BatchWorker will write the data to the database AppFabricPersistenceDB when i submit the batch and it will delete the record after it done, but it won't write to AppFabricMonitoringDB. Also I get the following error message "Unable to connect to the database used by the following application(s) (Default Web Site/BatchWeb). Dropping event with event ID 108. This event has occurred 63 times." from the Administrative Events log.
    • From the IIS Manager, I can see the ConnectionString for the "ApplicationServerMonitoringConnectionString" is "Data Source=SALExxxx2\SQL2008;Initial Catalog=AppFabricMonitoringDB;Integrated Security=True" and the Entry Path is "MACHINE/WEBROOT"
    • Go to all programs through the start menu and open the help for app fabric and it will say the version there. Mine is "Appfabric 1.1 for Windows Server"
    • I saw a issue. I find out that my SQL Server Agent is not auto start when I reboot my computer. Once I start the SQL Server Agent, the record is update to the AppFabricMonitoringDB. 
    • I am running appfabric 1.1. I think that may be my issue with this sample, but not sure. I can run it locally on my computer but cannot get it to auto start.
  • Getting the solution working on my local box
    6 Posts | Last post December 23, 2011
    • I have replicated all the code in a new project on my computer, one this is that when I try to add my service reference locally I do not get any method for the proxy called BatchWorkerClient there fore I cannot invoke SubmitJob. In my config file I noticed that when I add the service reference it doesn't look completely like the example. It is putting in a http address for the service reference instead of the net.pipe address. Any help would be appreciated. Thanks!
    • When you add a service reference http:// is used by default.  You can switch it to net.pipe:// if you want but you have to be sure net.pipe is enabled in your IIS application (this is required for AppFabric anyway).
    • So in your solution did you add the net.pipe:// protocol in your web config manually. I do have net.pipe enabled in IIS for this website and I still didn't get BatchWorkerClient method auto generated in the reference.cs file.
    • Ok I when I add the service reference I put in http://batchweb/BatchWorker/BatchWorker.xamlx and name my service reference "Services". It automatically added the endpoint and the bindings for net.pipe. However, I still don't get the method BatchWorkerClie​nt in auto generated in the Reference.cs to call from the BatchAutoStartFactory. The only methods it generated was SubmitJob, StopJob and QueryJob. Thanks for your help.
    • The BatchWorkerClient is in the BatchWeb\Service Refererences\References.cs file of the source code for this sample.
    • Yes I understand that. But when I add the service reference it is not automatically produced in my Reference.cs file. I have your sample running locally, but I cannot get it to auto start. IIS is set up as enable auto start.
  • Config the AppFabric Database
    3 Posts | Last post December 15, 2011
    • I install the Windows Server AppFabric and run the Configure AppFabric too. But the fields it create on the ASWfEventsTable is less then the one you have. Also you can see that the table name is deferent too. Am I running the correct Version? Thanks!
    • AppFabric 1.1 was recently released - could it be that you are using that version?  I haven't looked to see if the tables are different in the 1.1 release.
    • Thank you for the quick reply. I find it is my problem. I should look at the Views first. 
  • Getting it to run
    2 Posts | Last post December 08, 2011
    • Hi, thanks for the post. I don't have much experience with ASP.Net but I want to get this example running to play around with.
      What are the manual changes I need to make in order to run this? I changed database connection string in web.config file but it complains about dbo.ASWfInstances not found. 
      
      thanks!
    • You need to install and configure Windows Server AppFabric with AppFabricPersistenceDB and AppFabricMonitoringDB on (localhost)\SQLExpress.  Use the Configure AppFabric tool to do this.