Friday 14 June 2019

MVC - Web Service - Catch Timeout exception

Watch this example on YouTube


 

  localhost.WebService1 test = new localhost.WebService1();
            test.Timeout = 1000;
            try
            {
                var res = test.HelloWorld();
            }
            catch (System.Net.WebException e) when (e.Status == System.Net.WebExceptionStatus.SecureChannelFailure)
            {
                string error = e.Message;
            }

            catch(Exception e)
            {
                string error = e.Message;
            }

No comments:

Post a Comment