title: Is there some way to handle async/await behind an ASMX service?
body: <p>I have a web app serving a WCF REST API for JSON and an ASMX web service. The application has been around for a few years. It's based on ASP.NET 2.0, but upgraded to .NET 4.0 a couple of years ago, and I just upgraded to .NET 4.5 to be able to use the new async framework.</p>
  
  <p>Behind the application are some legacy services, and I realized that there is a big potential for increasing the performance by going async. I have implemented async all the way through the application, and everything is working perfectly through the WCF REST API.</p>
  
  <p>Too late I discovered that the ASMX API fails, I wanted methods like this:</p>
  
  <pre><code>[WebMethod(Description = "Takes an internal trip ID as parameter.")]
  async public Task&lt;Trip&gt; GetTrip(int tripid)
  {
      var t = await Trip.GetTrip(tripid);
      return t;
  }
  </code></pre>
  
  <p>I then learned that async/await isn't supported in ASMX at all, and everybody advises to migrate to WCF. I am not too joyful about this. The ASMX (actually three of them) are stuffed with different methods, and there are loads of API consumers that we want to keep serving from the old API.</p>
  
  <p>But we need the increased performance! Does anybody know about a workaround so I can keep using async/await behind the ASMX, but expose the ASMX as before?</p>