1

当应用程序启动时,它将运行 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;
    }
4

1 回答 1

1

这只是告诉您无论 web 服务正在做什么都已超时并且可能不可用。也很难说出“解决异常”是什么意思,如果 web 服务不可用,你可能无能为力。

于 2013-02-23T03:57:32.483 回答