当应用程序启动时,它将运行DispatcherTimer。每10秒,它将运行running()函数,而running()函数使用web服务并且运行良好。当系统无法获取Web服务时,它会弹出“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;
}
答案 0 :(得分:1)
这只是告诉你,无论web服务做了什么都已经超时并且可能无法使用。通过“解决异常”很难说出你的意思,如果网络服务不可用,你可能无能为力。