I have an ASP.NET webservice (.asmx) with a simple method that reads something from the DB with a sync call (ExecuteReader) and returns the result. There is any way to optimize the Thread Pool usage (ie. by calling an async call (BeginExecuteReader)) without changing the method’s signature?
The intention is to not block a thread pool thread while the database operation is in progress; it is not the intention to speed things up by doing multiple operations in parallel.
Actually, the answer is yes. See Asynchronous XML Web Service Methods.
Although you create an async web method with Begin* and End* methods, .NET will only create a single operation in the WSDL. This is obvious if you think about it – what would a Java client do with an
IAsyncResult?The client can call the operation synchronously or asynchronously.