Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:03:15+00:00 2026-06-11T09:03:15+00:00

When attempting to Resume a Workflow with the following code: public WorkflowApplication LoadInstance(Guid instanceId)

  • 0

When attempting to Resume a Workflow with the following code:

    public WorkflowApplication LoadInstance(Guid instanceId)
    {
        if (this.instances.ContainsKey(instanceId))
            return this.instances[instanceId];

        WorkflowApplication instance = new WorkflowApplication(new Tarpon.Workflows.CreateContact());

        //  Create Persistable Workflow           
        SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["WorkflowPersistance"].ConnectionString);
        store.HostLockRenewalPeriod = new TimeSpan(0, 0, 5);
        instance.InstanceStore = store;

        //  Load Instance
        instance.Completed += OnWorkflowCompleted;
        instance.Idle += OnIdle;
        instance.PersistableIdle += OnIdleAndPersistable;
        instance.Aborted += OnAborted;
        instance.Load(instanceId);

        //  Save instance in list of running instances
        this.instances.Add(instance.Id, instance);       // ERROR IS THROWN HERE

        return instance;
    }

I get and error on the line “this.instances.Add(instance.Id, instance)“:

The execution of an InstancePersistenceCommand was interrupted because the instance '9b9430b6-f182-469d-bcae-0886d546f7ea' is locked by a different instance owner. 
This error usually occurs because a different host has the instance loaded. The instance owner ID of the owner or host with a lock on the instance is '30411662-b9b3-4250-9e2c-5aaa9895b740'.

I have attempted to lower the HostLockRenewalPeriod in the above code, and also added the below code to hopefully disable the lock on the Instance but to no avail. It also never seems to break into the below code. Every time I go past the Load() method, I get th above error.

    public PersistableIdleAction OnIdleAndPersistable(WorkflowApplicationIdleEventArgs e)
    {
        instances.Remove(e.InstanceId);
        return PersistableIdleAction.Unload;
    }

It seems this code works half the time, but the other half it does not resume it’s workflows correctly.
Does anyone have any clue to what I can do to remove the lock properly, without having to re-write all of this functionality?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:03:16+00:00Added an answer on June 11, 2026 at 9:03 am

    Please take a look at this blog post describing persistance and instaneStore confiuration.

    This code is copied from the post and I think it might help you: “

    var instanceStore = new SqlWorkflowInstanceStore(connStr); 
    var instanceHandle = instanceStore.CreateInstanceHandle();
    var createOwnerCmd = new CreateWorkflowOwnerCommand();
    var view = instanceStore.Execute(instanceHandle, createOwnerCmd, TimeSpan.FromSecond(30));
    instanceStore.DefaultInstanceOwner = view.InstanceOwner; 
    // Do whatever needs to be dome with multiple WorkflowApplications 
    var deleteOwnerCmd = new    DeleteWorkflowOwnerCommand();
    instanceStore.Execute(instanceHandle, deleteOwnerCmd, TimeSpan.FromSeconds(30));
    

    The key is the CreateWorkflowOwnerCommand that needs to be executed at the start. And when you use the CreateWorkflowOwnerCommand just make sure not to forget the DeleteWorkflowOwnerCommand otherwise all workflow will remain locked by the owner and can’t be reloaded by another SqlWorkflowInstanceStore

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to compile the following code under Qt SDK 4.7.4 for Desktop - MinGW
Attempting to run this gl gear code on a virtual machine results in the
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to generics-ify some legacy code, I'm stuck. I have a ParentObject which wraps
Attempting to follow this Java tutorial . About 63 pages in, you are instructed
I'm attempting to modify a mySQL query (that works) to return a more specific
I'm attempting to start a process from a piece of code but I want
This is the only code messing up the php, I removed it and it
This is the only code messing up the php, I removed it and it
Attempting to find printers / shares in Active Directory using C#. This is my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.