How do you measure the progress of a web service call?

后端 未结 6 835
遇见更好的自我
遇见更好的自我 2020-12-20 18:46

I have an ASP.NET web service which does some heavy lifting, like say,some file operations, or generating Excel Sheets from a bunch of crystal reports. I don\'t want to be b

6条回答
  •  既然无缘
    2020-12-20 19:31

    You can also use SoapExtensions to notify your client of the download/process progress. The server can then send events to the client. Nothing in the client has to be changed if you don't use it.

    Allows for something like this in your client:

    //...
    private localhost.MyWebServiceService _myWebService = new localhost.MyWebServiceService ();
    _myWebService.processDelegate += ProgressUpdate;
    _myWebService.CallHeavyMethod();
    //...
    
    private void ProgressUpdate(object sender, ProgressEventArgs e)
    {
      double progress = ((double)e.ProcessedSize / (double)e.TotalSize) * 100.00;
      //Show Progress...
    }
    

提交回复
热议问题