将ASP.NET与Windows工作流基础一起使用 [英] Using ASP.NET with windows workflow foundation

查看:74
本文介绍了将ASP.NET与Windows工作流基础一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用Windows工作流基础构建一个asp.net Web应用程序.

I try to build up a asp.net web application with windows workflow foundation.

我发现了一些有用的网站,例如:

I have found some useful sites like:

http://msdn.microsoft. com/en-us/library/bb628441%28v = vs.90%29.aspx

http://msdn.microsoft. com/en-us/library/bb675262%28v = vs.90%29.aspx

工作流程是一个活动

<Activity mc:Ignorable="sap" x:Class="ApproachWithWorkflows.WriteLineActivity" sap:VirtualizedContainerService.HintSize="654,676" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart sad:XamlDebuggerXmlReader.FileName="C:\Documents and Settings\hauke\Desktop\Uni\Masterarbeit SVN SE\Software\Workflowansatz\ApproachWithWorkflows\ApproachWithWorkflows\WriteLineActivity.xaml" sap:VirtualizedContainerService.HintSize="614,636">
<sap:WorkflowViewStateService.ViewState>
  <scg3:Dictionary x:TypeArguments="x:String, x:Object">
    <x:Boolean x:Key="IsExpanded">False</x:Boolean>
    <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
    <av:Size x:Key="ShapeSize">60,75</av:Size>
    <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 295.5,107.5 295.5,129</av:PointCollection>
  </scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Flowchart.StartNode>
  <x:Reference>__ReferenceID0</x:Reference>
</Flowchart.StartNode>
<FlowStep x:Name="__ReferenceID0">
  <sap:WorkflowViewStateService.ViewState>
    <scg3:Dictionary x:TypeArguments="x:String, x:Object">
      <av:Point x:Key="ShapeLocation">190,129</av:Point>
      <av:Size x:Key="ShapeSize">211,59</av:Size>
    </scg3:Dictionary>
  </sap:WorkflowViewStateService.ViewState>
  <WriteLine sap:VirtualizedContainerService.HintSize="211,59" Text="worked.." />
</FlowStep>

我用一个简单的按钮创建了一个asp.net项目:

I created an asp.net project with a simple button:

<asp:Button Text="Purchase" ID="Label1" runat="server" OnClick="btnClick" />

在后面的代码中,我尝试调用工作流(并通过Application_Start在global.asax中初始化了WorkflowRuntime):

In the code behind, I try to call the workflow (and initialized the WorkflowRuntime in the global.asax by Application_Start):

WorkflowRuntime workflowRuntime = Application["WorkflowRuntime"] as WorkflowRuntime;
ManualWorkflowSchedulerService manualScheduler =
    workflowRuntime.GetService(typeof(ManualWorkflowSchedulerService))
    as ManualWorkflowSchedulerService;

WorkflowInstance instance = workflowRuntime.CreateWorkflow(
    typeof(ApproachWithWorkflows.WriteLineActivity));
instance.Start();
manualScheduler.RunWorkflow(instance.InstanceId);

当我现在执行应用程序并按下按钮时,在CreateWorkflow上出现类似输入的工作流程类型必须是Activity.\ r \ n参数名称:workflowType"之类的错误.

When I now execute the application and press the button, I get an error like "The input workflow type must be an Activity.\r\nParameter name: workflowType" at CreateWorkflow.

但活动是活动!我在做什么错了?

But the Activity is an Activity! What am I doing wrong?

推荐答案

您似乎正在使用WF 3.5运行时类执行WF 4.0活动.看一下WorkflowInvoker或WorkflowApplication.

It looks like you're using WF 3.5 runtime classes to execute a WF 4.0 activity. Take a look at WorkflowInvoker or WorkflowApplication.

这篇关于将ASP.NET与Windows工作流基础一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆