Web Services (ASMX 1.1) Performance Guidelines - One-Way (Fire-and-Forget) Communication

From Guidance Share

Jump to: navigation, search

- J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman


Consider using the OneWay attribute if you do not require a response.

Consider using the OneWay attribute if you do not require a response. Using the OneWay property of SoapDocumentMethod and SoapRpcMethod in the System.Web.Services.Protocols namespace frees the client immediately instead of forcing it to wait for a response.

For a method to support fire-and-forget invocation, you must decorate it with the OneWay attribute, as shown in the following code snippet.


  [SoapDocumentMethod(OneWay=true)]
  [WebMethod(Description="Returns control immediately")]
  public void SomeMethod() 
 {…}

This is useful if the client needs to send a message, but does not expect anything as return values or output parameters. Methods marked as OneWay cannot have output parameters or return values.

Personal tools