当应用程序启动时,它将运行 DispatcherTimer。每隔 10 秒,它会运行 running() 函数,并且 running() 函数消耗一个 web 服务,它运行得很好。当系统无法获取webservice时,会弹出“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;
}