Raj Rao
Raj Rao

Reputation: 9138

Calling WCF operation that has no return value asynchronously

I have a long running operation:

void LongRunningOperation(string someValue);

How do i call it asynchronously (I want a fire and forget mechanism)?

Upvotes: 1

Views: 1033

Answers (2)

Tarang
Tarang

Reputation: 656

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.

Upvotes: 4

Brian Driscoll
Brian Driscoll

Reputation: 19635

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.

Upvotes: 0

Related Questions