PersistableIdle事件和WorkflowApplication.Load多线程问题 [英] PersistableIdle event and WorkflowApplication.Load multithreading issues
问题描述
你好
我是Workflow Foundation的新手,并且遇到了以下问题.
问题1-调用完成后返回Unload时,PersistableIdle事件不会触发Unload事件
我正在托管自己的工作流,但没有使用WorkflowServiceHost.
我已经创建了一个工作流程,并且在单线程环境中一切正常.
当我处理同一个工作流程的多个实例时,PersistableIdle事件完成,并且我返回Unload,但从未触发Unload事件.我为每个工作流程实例和每个WorkflowApplication创建了单独的WorkflowApplication 共享同一个SqlWorkflowInstanceStore.
为什么会发生这种情况,我没有任何错误吗?
问题2-WorkflowApplication.Load事件挂起
在多线程环境中运行时,线程挂在WorkflowApplication.Load方法内部.
有任何想法为什么会发生这种情况,再次我没有收到任何错误消息?
将其放入web.config文件中,并查看日志是否有帮助.
< system.diagnostics>
< sources>
<源名称="System.Activities"; switchValue =信息">
<侦听器>
< add name =" textListener" />
<删除名称=默认"; />
</listeners>
</source>
</sources>
< sharedListeners>
< add name =" textListener"
类型="System.Diagnostics.TextWriterTraceListener"
initializeData ="MyTraceLog.txt"
traceOutputOptions ="ProcessId,DateTime"; />
</sharedListeners>
< trace autoflush ="true"; indentsize ="4">
<侦听器>
< add name =" textListener" />
</listeners>
</trace>
</system.diagnostics>尝试将Persist保持并加载到外部交通(如果有)之外.
使用(var ts = new System.Transactions.TransactionScope(TransactionScopeOption.Suppress)){
m_WorkflowApplication.Persist/Load();
ts.Complete();
}
当wf闲置时(通常是对于armourark),将调用PersistableIdle,而在卸载wf或wf端时不会调用PersistableIdle.
HTH
e.s.
Hello,
I'm new to Workflow Foundation and I've encountered the following problems.
Problem 1 - PersistableIdle event does not fire the Unload event when I return Unload after the call has finished
I'm hosting my own Workflows and I'm not using the WorkflowServiceHost.
I've got one workflow that I've created and everythings works as I expect in a single threaded environment.
When I am processing more than one instance of the same workflow the PersistableIdle event completes and I return Unload but the Unload event never fires. I've created separate WorkflowApplication for each workflow instance, and each WorkflowApplication is sharing the same SqlWorkflowInstanceStore.
Any ideas why this could happen, I don't get any errors?
Problem 2 - WorkflowApplication.Load event hangs
When running in a multi-threaded environment the thread hangs inside WorkflowApplication.Load method.
Any ideas why this could happen, again I don't get any errors?
put this in the web.config file and see if the logs helps.
<system.diagnostics>
<sources>
<source name="System.Activities" switchValue="Information">
<listeners>
<add name="textListener" />
<remove name="Default" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="textListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="MyTraceLog.txt"
traceOutputOptions="ProcessId, DateTime" />
</sharedListeners>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="textListener" />
</listeners>
</trace>
</system.diagnostics>try putting Persist and load outside trabsactions (if any).
using (var ts = new System.Transactions.TransactionScope(TransactionScopeOption.Suppress)) {
m_WorkflowApplication.Persist/Load();
ts.Complete();
}PersistableIdle is called when the wf goes idle (for a boomark typically) ,, it is not called when you unload a wf or the wf end.
HTH
e.s.
这篇关于PersistableIdle事件和WorkflowApplication.Load多线程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!