static void Main(string[] args) { // Create the client for the service ClaimsAwareWebServiceClient client = new ClaimsAwareWebServiceClient(); Console.WriteLine("-------------WCF Client Application--------------\n"); while (!ShouldQuitApplication()) { try { Console.WriteLine(client.ComputeResponse("Hello World")); } catch (CommunicationException e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Exception ex = e.InnerException; while (ex != null) { Console.WriteLine("==========================="); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); ex = ex.InnerException; } } catch (TimeoutException) { Console.WriteLine("Timed out..."); } catch (Exception e) { // For illustrative purposes only the sample code captures generic exceptions. // It is highly recommended that error messages should be explicitly trapped before used in production. Console.WriteLine("An unexpected exception occured."); Console.WriteLine(e.StackTrace); } } client.Close(); if (client != null) { client.Abort(); } }
static void Main( string[] args ) { ClaimsAwareWebServiceClient client = new ClaimsAwareWebServiceClient(); try { Console.WriteLine(client.ComputeResponse("Hello World")); client.Close(); } catch (CommunicationException e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Exception ex = e.InnerException; while (ex != null) { Console.WriteLine("==========================="); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); ex = ex.InnerException; } } catch (TimeoutException) { Console.WriteLine("Timed out..."); } catch (Exception e) { Console.WriteLine("An unexpected exception occured."); Console.WriteLine(e.StackTrace); } finally { if (null != client) { client.Abort(); } } }