.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get the current workflow instance ID in a WF4 workflow service

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :Windows Application

Is it possible to somehow query the current workflow instance ID (or another unique identifier) within code executed as part of a workflow service?


public sealed class SomeCodeActivity : CodeActivity
  public InOutArgument<List<string>> Messages { get; set; }

  protected override void Execute(CodeActivityContext context)
    var logger = new SimulatedLogger();

public class SimulatedLogger
  public void CreateLog(IList<string> messages)
    //This line throws an exception

View Complete Post

More Related Resource Links

Dynamically get the current instance of the workflow within a re-hosted WPF application



the scenario is: I create a re-hosted WPF application for the workflow designer, and within this designer I can edit the workflow(sequence, flowchart) with pre-defined and custom activities. The question is, how can I programmatically get an instance of the current workflow. Thereafter I can do some manipulations on this instance.



Extension instance management for workflow service


I have written some custom activities for business validation (http://www.neovolve.com/post/2010/10/13/Custom-Workflow-activity-for-business-failure-evaluatione28093Wrap-up.aspx with project source at http://neovolve.codeplex.com/SourceControl/changeset/view/68064#1422354). They have worked fine until I use them in a workflow service.

The evaluator activity pushes a business failure into a custom extension. The custom extension will then detect whether the evaluator is contained in a scope activity. If there is a scope activity, it will store the failure in the extension for the scope to collect later. If there isn't a scope, it will throw an exception straight away. The scope will look for failures in the extension written by its child activities when it completes and will throw an exception for the set of failures.

This has worked fine so far for workflows executed via WorkflowInvoker and WorkflowApplication. There are unit tests for these activities to ensure that the above behavior is working as expected.

I have just used these activities in a workflow service and found that the extension behavior is very different. The function p

Web Service Workflows: Deploy Distributed Business Processes With Windows Workflow And Web Services


Due to the distributed nature of a business process it makes sense for a workflow to be deployed as a distributed application. See how Windows Workflow and Web Services hold the key.

Israel Hilerio

MSDN Magazine October 2006

Can I dehydrate the Workflow object as well as the instance?

Hiya All Can I dehydrate the workflow object (i.e. not an instanciation of it) into SQLServer?  I want to save all versions created of a workflow so that I can chose to instanciate the workflow from any of the previous versions if I need to. This is due to a compliancy issue - being able to reconstruct the data created by a previous version of a workflow to prove accuracy. ThanksMichelle x

Is there a way to check if workflow instance already exists for a particular productID in Workflow o

I am using Visual Studio 2008 and .NET 3.5. I am trying to build a WF that is exposed as WCF hosted on IIS. This service is consumed by ASP.NET client. It is a very simple WF- receive info for new product "A"- send email to person 'Xyz' that new prodcut "A" is received- do some business process for product "A"- send out more notifications for product "A"Consider this scenario - - Client hits submit on asp.net page for prodcut "A"- new WF instance is created for product "A"- client can go back to the same page, edit some more info and hit save again. However, this time or for any subsequent "Saves",  I do not want to create a new WF instance for product "A".I can check to see if a WF instance exists for product "A" on the client side before calling the service operation. However, I want to see if there is a way to do this in WF or WorkflowServiceHost, as I don't want to add this logic to client. First acitvity in WF has to be receive activity with CanCreateInstance = true, so not sure how I can do this check in WF itself.Also, I have another stupid question, when using WF exposed as WCF service, do we have to implement all service operations using WF? What if I have some service operations that just involves checking some business logic? Do I implement this in a

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

WCF Workflow Service Application - Required Extensions

Hello, I built a WCF Workflow Service App and I built a custom activity that requires an extension in the workflow. In a web app, I'm trying to create a service reference to the WCF workflow service but it says that an extension that is required has not been provided; so how do I consume a service with a required extension? At what point do I supply that extension in an ASP.NET scenario? Thanks. http://linkedin.com/in/brianmains

Workflow Service failing on high load

Hi, I am load testing my workflow service to ensure that it can sustain high loads for a high volume transaction application. I am using Visual Studio's Load Test to run on a simple unit test to call the workflow service. I have configured the bindings on my service as follows:  <bindings>      <netTcpBinding>        <binding portSharingEnabled="true" closeTimeout="00:10:00"                 openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"                 maxBufferPoolSize="20480000" maxBufferSize="20480000" maxConnections="10"                  maxReceivedMessageSize="20480000"  >                    <security mode="None" />        </binding>      </netTcpBinding>  &n

Display XAML workflow image in browser and hightlight the current Activity

I have a requirement in project to display the XAML workflow in browser as image like the Visual studio designer displaying and it should Hightlight the current activity in workflow.  Please guide me on this.rajeevkalyan

Unable to call an asmx web service using windows authentication from a Service workflow

Hello, I need to use an existing asmx service from inside my service workflow and I am unable to call it. This asmx service is hosted in a web application with iis set to windows authentication, anonymous is not allowed. I need to send the authentication, only way seems too be using transport for basicHttpBindings. Every time I try to call the service I get an error saying that there is nothing listening to the url of the service generated automatically by VS when I added the Service Reference ? my web config <configuration> <configSections> </configSections> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <protocolMapping> <add scheme="http" binding="wsHttpBinding" bindingConfiguration="WindowsCreds" /> </protocolMapping> <bindings> <basicHttpBinding> <binding name="UtilitiesSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

WCF Workflow Service Hosting

Is there any way I can host a WCF Workflow Service Application in a Windows service instead of IIS?

Workflow Service not calling workflow in another project

I have a windows workflow service 4.0 that calls a workflow located in another project (i.e. another assembly). I have created a project reference in my workflow service project to the workflow in the other assembly. I have set a breakpoint in the workflow service receive activity and this breakpoint is hit. Next I step into the next activity which is an activity located in another project and the debugger does not work. Also the other workflow is sending an email.  It appears that the other workflow is not being called because I never receive an email from the workflow in the other project.   Any help is greatly appreciated.

Workflow Instance ID field in MS Access

Hello, please help! When I open a SP list with MS Access (Action > Open with Access), the Workflow Instance ID field is available with no data.  How can I get this field to display so I can create queries within MS Access using joins/relationships?  Thank you!

RESTful WCF Workflow Service

Folks,   I'm in the middle of building a service (.xamlx) that is basically going to support a document submission workflow. Via the web service, I want clients to be able to POST a big ol' XML file into my system. This is going to kick off a big, long-running, persistable, AppFabric-managed workflow. Clients will be able to poll this (or another) service to get the status of the document processing.   My issue right now is that it appears as though, out of the box, what I get is straight-up WSDL-style services that use standard web service tactics. I was wondering if there was something I could do, either via web.config or via the workflow designer, that would allow me to have my WCF-hosted workflow AND have the endpoint be a RESTful (or even REST-ish... i'm not picky) one. In other words, I want to be able to POST an arbitrary blob of XML to my workflow service (complete with authentication tokens in custom HTTP headers). Is this possible? If so, how?The .NET Addict - http://dotnetaddict.dotnetdevelopersjournal.com

Validate available operations on workflow service

I'd like to check if i can invoke an operation on workflow service so i could disable action buttons on my UI. Is it possible? If I invoke operation which isn't right at that moment I get exception: "Operation cannot be performed at this time. Please ensure that the operations are performed in the correct order and that the binding in use provides ordered delivery guarantees." And i would like to avoid theses kind of messages by validating before invoking. udione

Suspend / Resume Instances within Workflow Service Host (in Windows Service)

We are hosting WF 4 worklfow instances within a Windows Service that uses the Workflow Service host container.   On the Windows Service OnStart we start the workflow service host (w/ multiple WCF endpoints such as start workflow instance, cancel workflow instance, poll workflow instance status, etc.) and these endpoints create or work on one or more long running workflow instances.     My question is, if a user attempts to stop the Windows Service while workflow instance(s) are running, what is the best way to manage this scenario.   Our inclination is to persist these workflows (using sql persistence) and then on the next start of the Windows Service, resume these workflow instances and allow them to continue to completion.    In OnStart, we have a handle to the Workflow Service host.    How can we iterate through all the active workflow instances in OnStop and then in OnStart, resume these after the workflow service host is opened and running?   Are there are any methods of managing this scenario?    Thanks

Workflow Service 4.0 with One Way Receive activity will not get fired when called by a console based

Workflow Service 4.0 with One Way Receive activity will not get fired when called by a console based client application. This service does get called when there's the default ReceiveRequest coupled with a SendReply activity in the service. However deleting the ReceiveRequest and SendReply Activities and replacing it with a one way Receive Activity causes the Workflow 4.0 Service to not get called. Thanks, Leo Cono - http://www.YouLoveMe.com, Free Dating Site  
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend