How to call a web service in "fire and forget" way from ASP.Net

asp.net, asynchronous, c#, wcf, web-services

Solution

One way to implement a fire-and-forget approach is to use the `IsOneWay` property on the `OperationContract` attribute, like this:

[OperationContract(IsOneWay=true)]
public void SomeMethod(string someValue);

When set to true, the operation won't return a message. Note that methods marked as one-way cannot have return types or `ref` or `out` parameters (which makes sense). It also should not be confused with asynchronous calls, because it's not the same thing (in fact, a one-way call can block on the client if it takes a while to get a connection, for example).

See OperationContractAttribute.IsOneWay Property for more information.

Problem

I have a web service that I want to call from one of my asp.net classes. I can call my web service successfully.But now I need to call this service asynchronously. I need to call it and NOT wait for the service to complete execution. I don't need to process a response from the service and don't need to verify if the service executed successfully. All I want is to be able to call the service and be free to do other things.

Original source