ASP.NET MVC 中的 InvalidOperationException 和工作流

发布于 2024-08-13 02:21:57 字数 836 浏览 4 评论 0原文

我正在尝试使用 ASP.NET MVC 中的 StateMachineWrokflowInstance 查询正在运行的状态机工作流。

以下是场景:

  1. 工作流运行时配置:添加了 SqlWorkflowPersistenceServiceManualWorkflowSchedulerServiceExternalDataExchangeService 和注册的自定义 ExternalDataExchange具有 ExternalDataExchangeService 的服务;

  2. 执行顺序:

    var instance = WorkflowRuntimeHandle.CreateWorkflow(type);
    实例.Start();
    WorkflowRuntimeHandle.GetService
    ().RunWorkflow(实例.InstanceId);
    
    var stateMachineWorkflowInstance = new
    StateMachineWorkflowInstance(实例.WorkflowRuntime, 实例.InstanceId); 
    
  3. 收到错误:

    System.InvalidOperationException:在以下位置找不到 ID 为“[GUID]”的工作流 
    状态持久存储?
    

我做错了什么?

I'm trying to query a running state machine workflow using StateMachineWrokflowInstance in ASP.NET MVC.

Here is the scenario:

  1. Workflow runtime configuration: added SqlWorkflowPersistenceService, ManualWorkflowSchedulerService, ExternalDataExchangeService and registered custom ExternalDataExchange service with ExternalDataExchangeService;

  2. Execution sequence:

    var instance = WorkflowRuntimeHandle.CreateWorkflow(type);
    instance.Start();
    WorkflowRuntimeHandle.GetService<ManualWorkflowSchedulerService>
    ().RunWorkflow(instance.InstanceId);
    
    var stateMachineWorkflowInstance = new
    StateMachineWorkflowInstance(instance.WorkflowRuntime, instance.InstanceId); 
    
  3. Received error:

    System.InvalidOperationException: Workflow with id "[GUID]" not found in 
    state persistence store?
    

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一梦浮鱼 2024-08-20 02:21:58

显然这个异常可能有很多原因。

我找到了一种方法来找出罪魁祸首。
我为所有工作流运行时事件添加了处理程序,并将序列作为历史记录存储在列表中,并从列表中发现,在调用 RunWorkflow 后,工作流被终止。

WorkflowTermminate 事件参数 WorkflowTermulatedEventArgs 附带一个 Exception 属性,其中包括显示问题真正根源的内部异常。

我把这篇文章贴在这里,希望这篇文章对正在阅读的人有所帮助。

Apparently this exception could have many causes.

I found a way to detect the culprit.
I added handlers for all the workflow runtime events and stored the sequence as history in a list and discovered from the list that after RunWorkflow is called the workflow was terminated.

The WorkflowTerminated event parameter WorkflowTerminatedEventArgs comes with a Exception property which includes inner exceptions that showed the real source of the problem.

I'm posting this here in hope that this experience would be beneficial to those who are reading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文