类型为“System.timeOut异常”的未处理异常

问题描述:

当应用程序启动时,它将运行DispatcherTimer。每10秒钟,它将运行running()函数,函数running()消耗一个webservice并运行得非常好。当系统无法获得Web服务时,它会弹出“System.timeOut异常”。如何解决异常?类型为“System.timeOut异常”的未处理异常

感谢您的帮助您可以提供!

private void running() 
    {  
     ServiceReference1.WebServiceSoapClient test = new ServiceReference1.WebServiceSoapClient(); 

     test.ReadTotalOutstandingInvoiceCompleted += new EventHandler<ServiceReference1.ReadTotalOutstandingInvoiceCompletedEventArgs>(serviceClient); 

     test.ReadTotalOutstandingInvoiceAsync(); 
    } 

private void serviceClient(object sender, ReadTotalOutstandingInvoiceCompletedEventArgs e) 

    { 
     tbTesting.Text = e.Result.ToString(); 

     tbTextbox2.Text = "You have " + tbTesting.Text + " Invoice !!"; 
     ... 
     MessageBox.Show("You have " + tbTesting.Text + " new Invoice" +Environment.NewLine+ Environment.NewLine+ DateTime.Now, "Invoice", MessageBoxButton.OK); 
     ... 
     } 

在reference.cs

public string EndReadTotalOutstandingInvoice(System.IAsyncResult result) { 

     object[] _args = new object[0]; 
     string _result = ((string)(base.EndInvoke("ReadTotalOutstandingInvoice", _args, result))); 
     return _result; 
    } 

这只是告诉你,无论web服务做已超时且可能是不可用的。也很难说出你的意思是“解决例外”,如果web服务不可用,那么你可能无能为力。

+0

如果有消息框?当用户点击ok按钮时,系统将尝试访问web服务。如何应用此? – likewer 2013-02-23 04:17:36

+0

@像什么? – user2038443 2013-02-23 04:19:30

+0

虐待帮助你的问题,但我不写你的代码给你。 – user2038443 2013-02-23 04:29:34