title: Calling Async WCF service at Application_Exit
body: <p>I have the following code..</p>
  
  <pre><code> Private Sub Application_Exit(ByVal o As Object, ByVal e As EventArgs) Handles Me.Exit
          If MainPage.ModeOfOperation = "PROPOSALMODIFICATION" Then
  
              MainPage.InitializeServiceEndPoint(client.Endpoint)
              MessageBox.Show("This is a test")
              client.FlagQuotationWithUserAsync(MainPage.FetchQuotationNo, MainPage.FetchReferenceNo, "F", "", "", "")
  
  
  
          End If
  
      End Sub
  </code></pre>
  
  <p>But it doesnot work as I think Async calls are not allowed at the time of the application exit. </p>
  
  <p>I have also done the following</p>
  
  <ol>
  <li>Converting the Async method to sync by the following code in the WCF service :</li>
  </ol>
  
  <p>OperationContract(AsyncPattern:=False)</p>
  
  <p>and then calling it from the xaml like </p>
  
  <pre><code>client.SR_IService1_BeginFlagQuotationWithUser(FetchQuotationNo, ID, "T", UserRole, ProdCode, UserID, Nothing, Nothing)
  </code></pre>
  
  <p>But still the function is not being called at the time of the Application exit. </p>
  
  <p><strong>PLEASE NOTE : The main problem is that I want to do something at the time of the application close/exit and I have to call a WCF webservice. Please help I have no clue now..</strong></p>