.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


Posted By:      Posted Date: December 04, 2010    Points: 0   Category :WPF

Hi i am new in developing work flow.In my project i need that user can define workflow according to him . Is this possible to do so.If yes please tell me how i can achieve this .


Thanks in advance .

View Complete Post

More Related Resource Links

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        

Workflow Runtime

I was going to build one for myself, but has anyone developed a full-featured, production caliber WF 4.0 runtime for ASP.NET which includes persistence and dynamic control of instances?  I was hoping to just buy one to save time.

Workflow Runtime and Long Running Processes

I am trying to get a handle on the fact that applications have to manage the persistance of workflows directly. in 4.0.  If I set a workflow to run every night at 3:00 AM and then be persisted, how will I know that my application will be awake and ready to do the job.  I know that SharePoint currently uses a timer on the server which fires off every 5 minutes (default). 

System.Workflow.Runtime.Hosting.PersistenceException Timeout expired.

Is there a way for me to set the CommandTimeout property on the SqlCommand. I can see that there is a DbResourceAllocator that has a NewCommand that creates the SqlCommand but there is now way that I can change the CommandTimeout property. My workflow is quite large and I am save the Tracking information as well with the SharedConnectionWorkflowCommitWorkBatchService. These are the service that I load: string connectionString = ConfigurationManager.ConnectionStrings["DBConnectionWorkflowTracking"].ConnectionString; SqlWorkflowPersistenceService persistenceService = new SqlWorkflowPersistenceService(connectionString); persistenceService.EnableRetries = true; wr.AddService(persistenceService); SqlTrackingService sqlTrackingService = new SqlTrackingService(connectionString); sqlTrackingService.PartitionOnCompletion = true; sqlTrackingService.EnableRetries = true; wr.AddService(sqlTrackingService); SharedConnectionWorkflowCommitWorkBatchService wb = new SharedConnectionWorkflowCommitWorkBatchService(connectionString); wb.EnableRetries = true; wr.AddService(wb); wr.AddService(new CallWorkflowService()); wr.AddService(new CallWorkflowWorkflowLoaderService()); Can anyone help? Thanks Gert   

Edit workflow at runtime save in db and restart on per client basis

I need to be able to create a workflow in code (not a problem). Start the workflow and edit it depending on business logic (Add Parallel branches) save workflow in database per client. Pull workflow defintion from database by client and continue to work and persist as workflow progreeses. I thought XamlServices or ActivityXamlServices but i can't seem to get to the individual activities to edit.

System.Workflow.Runtime.QueueException + SPWorkflowExternalDataExchangeService



I have implemented a WorkFlow Service part of a state machine workFlow and time to time I get an error :

Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedException: Event "EmailOfferReceivedWorkflow" on interface type "OnBoardingStateWorkFlow.IEmailOfferWorkFlowService" for instance id "c67fc126-729f-4a61-802e-ac09b26282c3" cannot be delivered. ---> System.Workflow.Runtime.QueueException: Queue 'Message Properties  Interface Type:OnBoardingStateWorkFlow.IEmailOfferWorkFlowService  Method Name:EmailOfferReceivedWorkflow  CorrelationValues:  ' is not enabled.

Any idea ?






Workflow Error ......System.Workflow.Runtime.Hosting.PersistenceException :Cannot access a disposed

I have a workflow that works fine on our development server...However on the production server it gives the exception below....

I have compared the configuration on both the servers and its the same.
I have hard to get around this error...

Can someone help please...

.WorkflowRuntimeService._workflowRuntime_WorkflowTerminated() Workflow ab37dd8b-c642-4a2a-9573-566e54a566cf Terminated: System.Workflow.Runtime.Hosting.PersistenceException: Cannot access a disposed object.
Object name: 'Transaction'. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Transaction'.
  at System.Transactions.Transaction.Rollback(Exception e)
  at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
  at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)

Runtime Workflow Exception

Hi all,

I'm getting the following exception in my workflow:

System.Workflow.Runtime Error: 0 : Workflow Runtime: WorkflowExecutor: Persist attempt on instance 'baa9f2dd-d2fe-4f46-96ed-a31e75ecac96' threw an exception 'Cannot access a disposed object.
Object name: 'WorkflowRuntime'.' at    at System.Workflow.Runtime.WorkflowRuntime.VerifyInternalState()
   at System.Workflow.Runtime.WorkflowRuntime.GetService(Type serviceType)
   at System.Workflow.Runtime.WorkflowRuntime.get_WorkflowPersistenceService()
   at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)

How to get Workflow Runtime outside SharePoint Workflow class, while calling Handle External Event?



I have a state based workflow. Now, i want to change its state based on the event raised by my form(Like on Submit). I created the workflow and started it on the item in a doc Library. But, now when i want to register an external event we need to add that local service to the workflow runtime of the current executing workflow.

I am not able to find any way to do that or a workaround to achieve the same.

Does anybody has any idea about this??

Save Workflow Runtime as Application State or Session State for a website with multiple users?


I used Windows Workflow Foundation 3.5 as a page flow navigation for a ASP.NET website's Previous and Next page navigation.

The site acts like a shopping cart and each user has his own session and user data.  The app only has one WF.  I am not sure if I should generate one Workflow Runtime for every user or for simply generate one workflow Runtime for the entire application in my case?   

In the global.asax:

void Application_Start(object sender, EventArgs e)

void Application_End(object sender, EventArgs e)
    void Session_Start(object sender, EventArgs e)
        // Code that runs when a new session is started
        System.Workflow.Runtime.WorkflowRuntime workflowRuntime = new System.Workflow.Runtime.WorkflowRuntime(WorkflowManager.WorkflowRuntimeKey);


Disabling PerformanceCounter property in Workflow Runtime



 I am getting following exception for my long running workflows :

Custom counters file view is out of memory.

 Server stack trace:

   at System.Diagnostics.SharedPerformanceCounter.CalculateMemory(Int32 oldOffset, Int32 totalSize, Int32& alignmentAdjustment)

   at System.Diagnostics.SharedPerformanceCounter.CalculateAndAllocateMemory(Int32 totalSize, Int32& alignmentAdjustment)


I think Performance Counter is running Out Of  memory.

Is there any impact on disabling the Performance Counter property in WorkFlow( By default it is true)? If so please tell me the areas of concern.


workflow runtime start programmatically


hy, i create  in a visual web part an istance to my workflow that create a task, now i write this code in function button clic:

Dim mysite As SPSite = SPContext.Current.Site

        Dim myweb As SPWeb = SPContext.Current.Web

        Dim wfa As SPWorkflowAssociation

        Dim dictionarys As New Dictionary(Of String, Object)


        wfa = myweb.WorkflowAssociations.GetAssociationByName("Gestione_Task - Workflow1 ", CultureInfo.InvariantCulture)

        dictionarys.Add("prop", Int32.Parse(Me.TextBoxNR.Text)) 'prop è il nome della propiretà definita nel progetto gestione task

        dictionarys.Add("prop2", Int32.Parse(Me.TextBoxNF.Text))

        dictionarys.Add("prop3", Me.TextBoxCC.Text)


        Using workflowRuntime As New WorkflowRuntime()

            Dim workflowInstance As WorkflowInstance


            workflowInstance = workflowRuntime.CreateWorkflow(G

Workflow Runtime Crashed with Access Violation Exception




We have an AddInProcess32.exe hosting Workflow Runtime (.Net 3.51 SP1) and the program is targeted to run on a Windows 2008 server (SP2). During the stress testing, some 30-60 workflows were be executed by the program repeatedly for a few days. Everything looked fine except at one time  AddInProcess32.exe crashed with information at Windows Log

Faulting application AddInProcess32.exe, version 3.5.30729.1, time stamp 0x488ef947, faulting module mscorwks.dll, version 2.0.50727.4206, time stamp 0x4bf4c6a7, exception code 0xc0000005, fault offset 0x00024414, process id 0x%9, application start time 0x%10.

.NET Runtime version 2.0.50727.4206 - Fatal Execution Engine Error (73227B6E) (80131506)


We don't have any COM interop or PInvoke. Also, the failed workflow type has been executed successfully more than one thousand times except the one crashed above.


With WinDBG and the crashed dump file, we managed to get the calling sta

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Create new sql table at runtime VB.Net


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.

I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!

Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


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