locked
Help with Database Restore operation. RRS feed

  • Question

  • I have been working on adding backup and restore functionality to my application

    but I am facing an error at the end of my restore .

    Microsoft.LightSwitch.DataServiceOperationException was unhandled by user code
      Message=The transaction is in doubt.
    Inner exception message:
    A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
      StackTrace:
           at System.Transactions.TransactionStateInDoubt.EndCommit(InternalTransaction tx)
           at System.Transactions.CommittableTransaction.Commit()
           at Microsoft.LightSwitch.ServerGenerated.Implementation.DataService`1.<>c__DisplayClasse.<Microsoft.LightSwitch.ServerGenerated.Implementation.IODataService.SaveChanges>b__c()
           at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.InvokeOperationCore[T](String operationName, Object[] args, Boolean invokedFromODataClient, Func`1 invokeOperation, Action catchCallback, Action`2 serializeCustomExceptionInfo)
     

    I was hoping some could give me some insight on how to resolve this 

    right now I am catching the ApplicationData.SaveChanges(); , then closing down the entire application.

    the restore does work, but I want to avoid having to shut down the application and re- opening it to continue any work.

    Is there any other workaround to this ? . 

    I can post my current code if it is needed.. 

    thanks.

    DW

    Thursday, July 10, 2014 11:10 PM

Answers

  • I have figured out the Solution to the Issue..

    by adding SqlConnection.ClearAllPools(); after closing the connection , to my server side method I am able to run the restore without Errors.

    cheers

    DW

    • Marked as answer by DWisenbaugh Thursday, July 10, 2014 11:25 PM
    Thursday, July 10, 2014 11:24 PM