有关异步运行工作流应用程序的问题 [英] Question about running workflowapplication asynchronously
问题描述
我正在尝试在Workflow 4.0上进行练习-编写一个定制活动以异步执行子活动(如图表流或序列)(我起草的机制是动态创建工作流应用程序并调用活动已通过 中),并将其托管在WCF工作流服务中,然后从网站使用它.但是我真的遇到了这个模型的一个奇怪的问题,当我第一次从网页上访问这个工作流时,一切看起来都很好,我可以让两个不同的线程正常工作 但是,通常,当我第二次单击页面按钮并触发工作流时,后台线程似乎根本无法工作,因为我在其上设置了调试点,并且无法访问这些调试点.我不知道为什么〜???我真的希望能对此有所启发 问题,等待您的答复.如果我错过了任何事情,请通知我添加.
I am trying practice on Workflow 4.0 - and write a custom activity which is intended to execute a child activity(like a chartflow or sequence) asynchronously(the mechanism I drafted is to create workflow application dynamically and invoke activity passed in), and host it in a WCF Workflow service and consume it from a web site. But I really met a strange issue for this model, when I access this workflow from a web page in the first time, the everything seems working fine, I can get 2 different threads working normally, however, when I click page button and trigger workflow 2nd time, the background thread seems not working at all, because I set debug point on it, and no access to these debug points. I don't know why~??? I really hope get some guidance on this weird question, waiting for your reply. If anything I missed, please notify me to add.
代码部分:
[Designer(typeof(AsyncActivityWrapperDesigner))]
public class AsyncActivityWrapper : AsyncCodeActivity<bool>
{
public Activity Body { get; set; }
protected override void CacheMetadata(CodeActivityMetadata metadata)
{
metadata.GetArgumentsWithReflection();
base.CacheMetadata(metadata);
}
AutoResetEvent completed;
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
{
GetArgumentsAndVariables(context);
var extension = context.GetExtension<Extentions.MyExtention>();
completed = new AutoResetEvent(false);
WorkflowApplication app = new WorkflowApplication(Body);//body is passed in a flowchart or sequence activity for running asynchronously
app.Idle = (WorkflowApplicationIdleEventArgs eArgs) =>
{
Guid dui = eArgs.InstanceId;
};
app.Extensions.Add(extension);
context.UserState = app;
app.Completed = (WorkflowApplicationCompletedEventArgs eArgs) =>
{
推荐答案
没有人可以回答这个问题吗?
no anyone can answer this?
这篇关于有关异步运行工作流应用程序的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!