【发布时间】:2013-05-23 12:23:49
【问题描述】:
我正在尝试学习本教程On MSDN,以了解有关工作流服务及其工作原理的更多信息。现在我可能疯了,但我在教程的客户端部分遇到了问题(我很想把这个问题归咎于教程而不是我自己)。我在 StartOrderClient 初始化和 AddItemClient 上遇到了参考错误。这只是教程中的一个稍微不完整的步骤,还是我遗漏了什么?
提前非常感谢你。
以下是我的订单客户端控制台程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
using System.ServiceModel.Activities;
namespace OrderClient.OrderService
{
class Program
{
static void Main(string[] args)
{
// Send initial message to start the workflow service
Console.WriteLine("Sending start message");
StartOrderClient startProxy = new StartOrderClient();
string orderId = startProxy.StartOrder("Kim Abercrombie");
// The workflow service is now waiting for the second message to be sent
Console.WriteLine("Workflow service is idle...");
Console.WriteLine("Press [ENTER] to send an add item message to reactivate the workflow service...");
Console.ReadLine();
// Send the second message
Console.WriteLine("Sending add item message");
AddItemClient addProxy = new AddItemClient();
AddItem item = new AddItem();
item.p_itemId = "Zune HD";
item.p_orderId = orderId;
string orderResult = addProxy.AddItem(item);
Console.WriteLine("Service returned: " + orderResult);
}
}
}
这里是错误。我不相信在教程中定义了 StartOrderClient 和 AddItemClient。
找不到类型或命名空间名称“StartOrderClient”(您是否缺少 using 指令或程序集引用?)
找不到类型或命名空间名称“AddItemClient”(您是否缺少 using 指令或程序集引用?)
【问题讨论】:
-
什么样的参考错误?也就是说,具体来说,您的错误是什么?
-
错误发生的地点/时间?
-
好的......你仍然需要更具体。错误窗口应该告诉您找不到什么类型或命名空间。我需要这些信息来帮助你。
-
问的很明显,但是您是否添加了对工作流服务的服务引用并将
OrderService指定为命名空间? -
@IvanS 如果您已将服务引用添加到客户端项目,则需要添加“使用”语句,例如
using OrderService
标签: c# workflow-foundation workflowservice