private void ProcessResponse(IAsyncResult result) { try { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("In the async response handler."); SampleServiceClient responseClient = (SampleServiceClient)(result.AsyncState); string response = responseClient.EndSampleMethod(result); Console.Write("ProcessResponse: "); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(response); Console.ResetColor(); } catch (TimeoutException timeProblem) { Console.WriteLine("The service operation timed out. " + timeProblem.Message); } catch (CommunicationException commProblem) { Console.WriteLine("There was a communication problem. " + commProblem.Message); } catch (Exception e) { Console.WriteLine("There was an exception: " + e.Message); } }