How to stop the running wcf services in silverlight when exception happens -


After performing some excavation in handling exceptions to Silverlight and reading some useful blogs like this, I apply the same idea in App.xaml To stop the .CCC error page and call the event viewer to log the error, call the other WCF service method:

  Private Zero Application_Unmitted exceptions (Object Sender, ApplicationUnhandledExceptionEventArgs e) {If (! System.Diagnostics Debugger. ) {Var error page = new error (); ErrorPage.Show (); String error log = string Format ("{0} {1}", e.ExceptionObject.Message, e.ExceptionObject.StackTrace); Eventhandler & LT; WriteIntoEventLogCompletedEventArgs & gt; Callback = (S, EV) => {Bool result = ev.Result; }; (New Service Proxy & lt; ApplicationServiceClient & gt; ()) CallService & lt; WriteIntoEventLogCompletedEventArgs & gt; (Callback, errorMsg); E.Handled = True; }}  

And I have this error. Xaml.cs:

  Private Zero OKButton_Click (Object Sender, RoutedEventArgs e) {this.DialogResult = True; }  

When the user clicks on OK, the original error page will close the page.

Everything fixes many cases. The problem occurs when one of the callbacks is due to an WCF service exception. The error page will be displayed well and when the user clicks right the error page will close, but the background is still showing a busy indicator and the original service callback is still waiting for the response. I need to finish it in any form.

If someone can help, then I will become epicite.

> Thanks, COB

-

Thank you very much for your helpful reply. I used the same idea and added a code to check e in the original service callback method. It's not zero, close the window (it's a tad window) with a busy synchronizer and everything works right now. Thanks again. My value is that the original service callback may be complete, but in an error condition.

You may have to identify the status of the error and the busy Indicator's IsBusy property Can set back to false.

Some things to check things

  • Is the basic service callback returning to the least success? You can check it by placing a breakpoint in the original service callback method.

  • Did you correctly handle the error status in your callback method, for example -

  Void proxy_GetUser (object sender, GetUserCompletedEventArgs e) {if (e.Error! = Null) {getUserResult.Text = "Error obtaining user."; } Other {getUserResult.Text = "Username:" + e.Result.Name + ", Age:" + E. Results: A + +, is a member: "+ E. result. ISMMember; }}  

context -


Comments