开发者

Calling WCF operation that has no return value asynchronously

I have a long running operation:

void LongRunningOperation(string someValue);

How do 开发者_如何学Ci call it asynchronously (I want a fire and forget mechanism)?


you can set the mode to oneway.

you do not require to call these methods asynchronously. call to the methods returns as soon as they are call if the mode is one way.

use:

[OperationContract(IsOneWay = true)] attribute to describe your operation contract.


Assuming that you have already configured your proxy to the service, you will need to do the following (in VS):

  1. Open your project that references the service, then go to service references.
  2. Right-click the relevant service reference and select 'Configure Service Reference' from the context menu.
  3. Tick the box that says 'Generate asynchronous operations'
  4. After your client code regenerates, you will see a method that says BeginLongRunningOperation; that's your async method.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜