问题
I've downloaded Xamarin.Forms QuickStart Projects(server and cliente) from azure mobile app, then have published server project, so far so good, but i cannot access table controllers, unless i add query string as described.
http://myservice.azurewebsites.net/tables/todoitem?ZUMO-API-VERSION=2.0.0
or if i add ms_skipversioncheck to true in the portal.
Probably something related with server or client versions discrepance.
Even if i update all nuget packages, same thing, just receive BadRequest (400)
But with this server described above, when i run client Project(android simulator in visual studio) it Works fine in not syncing mode.
Once i download nuget sqlite localstore and uncomment the line:
//#define OFFLINE_SYNC_ENABLED
and make this line : await RefreshItems(true, syncItems: true);
to enable off-line mode, i receive only BadRequest(400), again
I dont know what i should check to make the versions compatible.
I did not include stack trace or logs because BadRequest is the only thing i received.
Let me known if you need some further information.
Thanks
Edit: I check this link out, but i coudnt solve my issue.
https://github.com/Azure/azure-content/blob/master/articles/app-service-mobile/app-service-mobile-client-and-server-versioning.md
Its drive me crazy
回答1:
In the body of the 400 bad request response, there is usually an error message included. You can view this with Fiddler (http://www.telerik.com/fiddler) or another web debugger.
Example:
Request GET http://azielnettest.azurewebsites.net/tables/todoitem
Response HTTP/1.1 400 Bad Request {"message":"No API version was specified in the request, this request needs to specify a ZUMO-API-VERSION of '2.0.0'. For more information and supported clients see: http://go.microsoft.com/fwlink/?LinkId=690568#2.0.0"}
Request http://azielnettest.azurewebsites.net/tables/todoitem?zumo-api-version=2.0.0
Response 200 {data....}
That's step 1 on debugging.
Step 2 would be to check
a) The packages.config of your server project that you deployed to your site. You should find something like this...
<package id="Microsoft.Azure.Mobile.Server" version="1.0.119.0" targetFramework="net45" />
b) The packages.config of your Xamarin Forms project.
<package id="Microsoft.Azure.Mobile.Client" version="2.0.1" targetFramework="win81" />
If your Microsoft.Azure.Mobile.Client version is lower than 2.0.0, it will not work against the Azure Mobile App backend because the zumo-api-version is not included in the headers in older clients.
Hope this helps.
回答2:
I followed the intructions on top off TodoItemManager.cs file.
// To add offline sync support: add the NuGet package WindowsAzure.MobileServices.SQLiteStore // to all projects in the solution and uncomment the symbol definition OFFLINE_SYNC_ENABLED // For Xamarin.iOS, also edit AppDelegate.cs and uncomment the call to SQLitePCL.CurrentPlatform.Init() // For more information, see: http://go.microsoft.com/fwlink/?LinkId=620342
The correct nuget package is Microsoft.Azure.Mobile.Client.SQLiteStore, off-line mode is working now.
Att
来源:https://stackoverflow.com/questions/35344691/azure-mobile-app-quickstart-trouble