title: Callback function is not executed in an asynchronous call
body: <p>I am trying to make a simple asynchronous call with WCF, but the callback function is never executed. Can anyone tell me what is wrong with the code?</p>
  
  <p>I am using visual studio 2008 with .Net 3.5</p>
  
  <p><strong>Service code</strong></p>
  
  <pre><code> [ServiceContract]
  public interface IService1
  {
      [OperationContract(AsyncPattern = true) ]
      IAsyncResult BeginGetData(string value, AsyncCallback callback, object state);
  
      string EndGetData(IAsyncResult result);
  }
  
  public class Service1 : IService1
  {
  
      #region IService1 Members
  
      public IAsyncResult BeginGetData(string value, AsyncCallback callback, object state)
      {
          return new CompletedAsyncResult&lt;string&gt;(value, state);
      }
  
      public string EndGetData(IAsyncResult r)
      {
          CompletedAsyncResult&lt;string&gt; result = r as CompletedAsyncResult&lt;string&gt;;
          return result.Data;
      }
  
      #endregion
  }
  </code></pre>
  
  <p><strong>Client side code</strong></p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
  
          Service1Client client = new Service1Client();
  
          Console.WriteLine("Start async call");
          IAsyncResult result = client.BeginGetData("abc", callback, null);
          Console.ReadLine();
      }
      static void callback(IAsyncResult result)
      {
          string a = "in callback";
  
          Console.WriteLine(a);
      }
  }
  </code></pre>