Reputation: 2771
Hello I am having the following exception:
Additional information: The request could not be completed. (Bad Request)
I did not understand why since the function worked sometimes I therefore found the following on stackoverflow: MobileServiceInvalidOperationException When Trying To Retrieve Data From Azure. This issue unfortunately does not solve my issue.
The time is correct and I am using https connection. And all the communication is working perfectly. I however have divided my Windows Phone Silverlight application into several projects, the reason for this I have stated in another stackoverflow question: Deleting project/pages/usercontrols from memory.
The application flow is:
Project 1:
await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO);
Success ALLWAYS!Application.Current.Resources.Add("NavigationParam", App.MobileService);
and Navigating to new project is done.MobileService = MobileServiceClient)Application.Current.Resources["NavigationParam"];
(information seems intact when looking into the debugger).await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO);
Success NEVER!I know the packages are in order in Project 2 because I can upload information to blob storage and the includes are the same in both projects. But as soon as I contact my own backend service the application crashes with the above exception.
So can anyone help me with this issue, do I need to create a new mobileserviceclient and reauthenticate? Seems stupid?
Upvotes: 1
Views: 136
Reputation: 1717
I'm not sure what is going wrong, but generally, I would recommend making a new client instance here.
To avoid a login issue I would look at caching the mobile service's token. (See: http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-dotnet-how-to-use-client-library/#caching)
Then you can spin up a new client, reuse your existing auth tokens/etc, and continue on.
Upvotes: 1