Workflow foundation WaitOne second run
I Load my next Action using standart way (resuming workflow)
public MoveNext(){
var instanceUnloaded = new AutoResetEvent(false);
var application = GetWorkflowApplication(instance.WorkflowDefinition);
application.InstanceStore = GetInstanceStore();
application.PersistableIdle = (e) => PersistableIdleAction.Unload;
application.Unloaded = (e) => instanceUnloaded.Set();
application.OnUnhandledException += (e) => { ... };
application.Load(instance.WorkflowID);
var newBookMark = new ActionBookmarkInput {ActionID = ActionID, Status
= status};
application.ResumeBookmark("Action" + ActionID, newBookMark);
instanceUnloaded.WaitOne();
}
Everything work correct till the moment when i want to get next step
inside this method.
public MoveNext(){
var instanceUnloaded = new AutoResetEvent(false);
var application =
GetWorkflowApplication(instance.WorkflowDefinition);
application.InstanceStore = GetInstanceStore();
application.PersistableIdle = (e) => PersistableIdleAction.Unload;
application.Unloaded = (e) => instanceUnloaded.Set();
application.OnUnhandledException += (e) => { ... };
application.Load(instance.WorkflowID);
var newBookMark = new ActionBookmarkInput {ActionID = ActionID,
Status = status};
application.ResumeBookmark("Action" + ActionID, newBookMark);
instanceUnloaded.WaitOne();
var nextAction = GetNextActionFromDB();
if (nextAction.AutoEvent){
MoveNext();
}
}
But When i called MoveNext() the 2nd times i've got an error (on the line
WaitOne())
{System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. ---> System.TimeoutException: The HTTP
request to 'localhost/Services/MyWorkflowService.svc' has exceeded the
allotted timeout of 00:01:00. The time allotted to this operation may have
been a portion of a longer timeout. ---> System.Net.WebException: The
request was aborted: The request was canceled.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult
result)
--- End of inner exception stack trace ---
Server stack trace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult
result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action,
Object[] outs, IAsyncResult result)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at
RDonors.WCFHost.Services.IMovesServiceAsync.EndCycleAction_MoveToNextAction(IAsyncResult
)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Talion.Async.ApmInvocation.OnInvokeCompleted(IAsyncResult ar) in
\Xtalion\Async\ApmInvocation.cs:line 60}
It's looked like i forgot something Close or Unload, by I already tryed
application.Unload(), instanceUnloaded.Close().... Is Anyone has idea what
i should to do?
No comments:
Post a Comment