Call WCF when silverlight application exit

252 views Asked by At

I am working on silverlight application.

I want to update a table field when user exit from silverlight application.

For this I have used below Wcf service in Application_Exit method

  private void Application_Exit(object sender, EventArgs e)
        {
             objProxy.SessionUpdateFieldsCompleted += objProxy_SessionGetUserCompleted;
             objProxy.SessionGetUserAsync();    

        }

But Wcf is not called here.

Is there any way to do this?

Thanks, Hitesh

1

There are 1 answers

0
Steve On

You can't call async operations on Application_Exit, because it exits before being processed from the queue. The closest you can do is have the user click something to close the app and run your code there. I know it sucks but it is what it is.