简体   繁体   中英

Error Windows Worklfow Foundation 4.0 The input workflow type must be an Activity. Parameter name: workflowType

I'm using windows workflow foundation 4.0 and I've created web Application on my button click event I have the following

Dictionary<string,object> dicobjParams=new Dictionary<string,object>();
            WorkflowRuntime workflowRuntime = Application["WorkflowRuntime"] as WorkflowRuntime;
            WorkflowInstance instance =workflowRuntime.CreateWorkflow(typeof(Activity1),dicobjParams);
            //workflowRuntime.CreateWorkflow(typeof(Activity1), dicobjParams).Start();
            workflowRuntime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(workflowRuntime_WorkflowCompleted);
            instance.Start();

but I always the following error

The input workflow type must be an Activity. Parameter name: workflowType

as mentioned in this thread I've made sure that I'm using 4.0 application and workflow.

Please view the code sample of application for further understanding

if you are using wwf 4.0 you cannot use WorkflowRuntime and instead of that you must use WorkflowApplication like :

Dictionary<string, object> dicobjParams = new Dictionary<string, object>();
Activity workflow1 = new MyApp.Activity1();
WorkflowApplication app = new WorkflowApplication(workflow1, dicobjParams );
app.Run();

i recommend to you to read : https://msdn.microsoft.com/en-us/library/ee342461.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM