需要样品火,忘记异步调用WCF服务 [英] Need sample fire and forget async call to WCF service

查看:176
本文介绍了需要样品火,忘记异步调用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在计划的时间间隔,我需要调用WCF服务调用另一个WCF服务asyncronously。要安排一个WCF服务,我制定了一个电话。

On a scheduled interval I need to call a WCF service call another WCF Service asyncronously. Scheduling a call to a WCF service I have worked out.

我想我需要和我看了一下这里计算器,这是必要的..,(实质)prepare或更改你的WCF服务为code到能够处理的异步调用它们。如果是的话会是什么那一个简单的例子是什么样子?(也许之前和之后的例子),也就是它仍然在.net 3.5有必要吗?

What I think I need and I have read about here on stackoverflow that it is necessary to.., (in essence) prepare or change the code of your WCF services as to be able to handle an async call to them. If so what would a simple example of that look like?(Maybe a before and after example) Also is it still necessary in .Net 3.5?

二,我使用从WCF服务做呼叫转移到下一个WCF服务的代理,需要一个异步调用WCF服务的一个样本,如果它看起来比什么是典型的与BeginEnvoke和EndEnvoke典型异步的例子有什么不同

Second I am using a proxy from the WCF Service doing the call to the next WCF Service and need a sample of an async call to a WCF service if it looks any different than what is typical with BeginEnvoke and EndEnvoke with typical async examples.

我会相信如果我完全关闭我的问题,将AP preciate任何修正,建立一个更好的问题也是如此。

I would believe it if I am completely off on my question and would appreciate any correction to establish a better question as well.

推荐答案

将<一个href=\"http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.isoneway(v=vs.110).aspx\"相对=nofollow> IsOneWay 的OperationContract特性的属性设置为true的WCF方法,你是打电话来。这告诉WCF呼叫仅事项一个方向和客户端将不会流连执行完毕的方法。

Set the IsOneWay property of the OperationContract attribute to true on the WCF method that you are calling to. This tells WCF that the call only matters for one direction and the client won't hang around for the method to finish executing.

甚至称BeginInvoke的,当你的客户端code依然会挂出等待服务器的方法来完成执行,但它会做一个线程池线程。

Even when calling BeginInvoke your client code will still hang-out waiting for the server method to finish executing but it will do it on a threadpool thread.

[ServiceContract]
interface IWCFContract
{
   [OperationContract(IsOneWay = true)]
   void CallMe()
}

其他的方式做你想要的是有WCF服务自旋的工作推后台线程并立即返回。

The other way to do what you want is to have the WCF service spin its work off onto a background thread and return immediately.

这篇关于需要样品火,忘记异步调用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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