在workflow中,无法为实例 ID“...”传递接口类型“...”上的事件“...” 问题的解决方法。
2009-07-23 12:16
706 查看
搭建自己的WF程序时碰到这样的错误:无法为实例 ID“b6badb4d-5955-4d2c-8e10-bf51fb0c6f56”传递接口类型“Land.Workflow.LocalService.ICaseService”上的事件“Create”。
搜了下,基本上都是这样的说法:把WaitForIdle 属性设置为true即可,如:args.WaitForIdle = true; 照做还是不行。
通过仔细研究发现,我们的一般会这样自定义自己的消息类型:
[Serializable]
public class CaseEventArgs : ExternalDataEventArgs
{
public CaseEventArgs(Guid instanceId)
: base(instanceId)
{
}
public CaseEventArgs(Guid instanceId, Case _case) :
base(instanceId)
{
this.Case = _case;
}
public Case Case
{
get;
set;
}
}
public class Case
{
}
CaseEventArgs 的[Serializable]是必须加的,这地球人都知道。
但是Case如果不加[Serializable]属性同样会出现无法传递事件错误。改成这样即可:
[Serializable]
public class Case
{
...
}
也就是CaseEventArgs中属性设涉及到的实体,必须都可序列化,因为其本身可序列化。
还有一种原因导致的
在微软的教材会教我们,创建WorkflowRuntime的时候,使用WorkflowFactory类(微软推荐的类),在里面写函数
public static WorkflowRuntime GetWorkflowRuntime()
{
lock (lockObject)
{
if (workflowRuntime == null)
{
// prev for shutdown
AppDomain.CurrentDomain.ProcessExit += new EventHandler(StopWorkflowRuntime);
AppDomain.CurrentDomain.DomainUnload += new EventHandler(StopWorkflowRuntime);
workflowRuntime = new WorkflowRuntime();
}
string dataBaseConnetion = ConfigurationManager.ConnectionStrings["TrackingDatabase2"].ConnectionString;
SqlTrackingService sqlTrackingService = new SqlTrackingService(dataBaseConnetion);
workflowRuntime.AddService(sqlTrackingService);
workflowRuntime.StartRuntime();
return workflowRuntime;
}
}
在创建 workflowRuntime.StartRuntime();这句话,他们推荐在这个里面写,因为你创建workflowRuntime的时候必然要StartRuntime,很多人在使用这个的时候,忘记了,在workflowRuntime的AddService方法之前不能StartRuntime,所以也会导致这样的错误。
搜了下,基本上都是这样的说法:把WaitForIdle 属性设置为true即可,如:args.WaitForIdle = true; 照做还是不行。
通过仔细研究发现,我们的一般会这样自定义自己的消息类型:
[Serializable]
public class CaseEventArgs : ExternalDataEventArgs
{
public CaseEventArgs(Guid instanceId)
: base(instanceId)
{
}
public CaseEventArgs(Guid instanceId, Case _case) :
base(instanceId)
{
this.Case = _case;
}
public Case Case
{
get;
set;
}
}
public class Case
{
}
CaseEventArgs 的[Serializable]是必须加的,这地球人都知道。
但是Case如果不加[Serializable]属性同样会出现无法传递事件错误。改成这样即可:
[Serializable]
public class Case
{
...
}
也就是CaseEventArgs中属性设涉及到的实体,必须都可序列化,因为其本身可序列化。
还有一种原因导致的
在微软的教材会教我们,创建WorkflowRuntime的时候,使用WorkflowFactory类(微软推荐的类),在里面写函数
public static WorkflowRuntime GetWorkflowRuntime()
{
lock (lockObject)
{
if (workflowRuntime == null)
{
// prev for shutdown
AppDomain.CurrentDomain.ProcessExit += new EventHandler(StopWorkflowRuntime);
AppDomain.CurrentDomain.DomainUnload += new EventHandler(StopWorkflowRuntime);
workflowRuntime = new WorkflowRuntime();
}
string dataBaseConnetion = ConfigurationManager.ConnectionStrings["TrackingDatabase2"].ConnectionString;
SqlTrackingService sqlTrackingService = new SqlTrackingService(dataBaseConnetion);
workflowRuntime.AddService(sqlTrackingService);
workflowRuntime.StartRuntime();
return workflowRuntime;
}
}
在创建 workflowRuntime.StartRuntime();这句话,他们推荐在这个里面写,因为你创建workflowRuntime的时候必然要StartRuntime,很多人在使用这个的时候,忘记了,在workflowRuntime的AddService方法之前不能StartRuntime,所以也会导致这样的错误。
相关文章推荐
- 在workflow中,无法为实例 ID“...”传递接口类型“...”上的事件“...” 问题的解决方法。
- 在workflow中,无法为实例 ID“...”传递接口类型“...”上的事件“...” 问题的解决方法。
- AE开发中关于 “无法嵌入互操作类型.........请改用适用的接口”问题的解决方法
- AE开发中关于 “无法嵌入互操作类型.........请改用适用的接口”问题的解决方法
- 如何解决JavaScript中UUID作为方法参数在方法中无法传递而数字却正常传递的问题
- VS2012中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- Visual Studio中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- VS2010,VS2012,VS2013中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- 解决“事件ID(487)的描述(在资源(Zend Optimizer)中)无法找到”问题
- VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- 无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- 无法将类型为excel.applicationclass的com 强制转换为接口类型的解决方法[转]
- VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法
- cocos2d-x 3.x 关于cocostudio的UI将事件吃掉,场景Layer无法响应手势的问题解决方法
- 解决WCF接口无法传递object参数的问题
- VS2010中无法嵌入互操作类型“......”,请改用适用的接口的解决方法