异步客户端服务器WCF

时间:2011-01-10 07:37:22

标签: wcf asynchronous client

我的客户端运行这样的服务:

ServiceHost=new ServiceHost(typeof(Service2),new Uri("http://..."));
ServiceMetadataBehavior smb=new ServiceMetadataBehavior();
smb.HttpGetEnabled=true;
smb.MetadataExporter.PolicyVersion=PolicyVersion.Policy15;
sh.Description.Behaviors.Add(smb);
sh.open();
在Service2类(实现Iservice)中的

我添加了一个函数:

bool returnResult(bool res)
{
return res;
}

我的客户端向服务器发送请求以验证XML文件,并且服务器通过在客户端上运行的server2激活returnResult函数来返回true / false。 结果怎样才能到达客户端? p.s我知道有什么事情,但我不知道如何...

1 个答案:

答案 0 :(得分:0)

我做到了!我在另一个类中声明了一个静态事件。客户端添加此事件的功能。服务器使用结果调用客户端上的服务器,客户端的服务器使用此值生成事件的Invokatin。