Azure移动应用-快速入门麻烦 [英] Azure Mobile app - QuickStart trouble
问题描述
我已经从azure移动应用程序中下载了Xamarin.Forms QuickStart Projects(服务器和客户端),然后发布了服务器项目,到目前为止一切顺利,但是除非按照说明添加查询字符串,否则我将无法访问表控制器.
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
或者如果我在门户网站中将ms_skipversioncheck添加为true.
or if i add ms_skipversioncheck to true in the portal.
可能与服务器或客户端版本差异有关.
Probably something related with server or client versions discrepance.
即使我更新了所有的nuget软件包,同样的事情,也只会收到BadRequest(400)
Even if i update all nuget packages, same thing, just receive BadRequest (400)
但是使用上述服务器,当我运行客户端Project(Visual Studio中的Android模拟器)时,它可以在不同步模式下正常工作.
But with this server described above, when i run client Project(android simulator in visual studio) it Works fine in not syncing mode.
一旦我下载了nuget sqlite localstore并取消了注释:
Once i download nuget sqlite localstore and uncomment the line:
//#定义OFFLINE_SYNC_ENABLED
//#define OFFLINE_SYNC_ENABLED
并进行以下一行: 等待RefreshItems(true,syncItems:true);
and make this line : await RefreshItems(true, syncItems: true);
要启用离线模式,我再次仅收到BadRequest(400)
to enable off-line mode, i receive only BadRequest(400), again
我不知道要检查哪些版本以使其兼容.
I dont know what i should check to make the versions compatible.
我没有包括堆栈跟踪或日志,因为BadRequest是我收到的唯一信息.
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.
谢谢
我检查了此链接,但我无法解决我的问题.
I check this link out, but i coudnt solve my issue.
它让我发疯了
推荐答案
在400错误请求响应的正文中,通常包含一条错误消息. 您可以使用Fiddler( http://www.telerik.com/fiddler )或其他Web调试器进行查看.
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.
示例:
请求 GET http://azielnettest.azurewebsites.net/tables/todoitem
响应 HTTP/1.1 400错误请求 {"message":"在请求中未指定API版本,此请求需要将ZUMO-API-VERSION指定为'2.0.0'.有关详细信息和受支持的客户端,请参见:
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"}
请求 http://azielnettest.azurewebsites.net/tables/todoitem?zumo -api-version = 2.0.0
响应 200 {data ....}
Response 200 {data....}
这是调试的第一步.
第2步是检查
a)部署到站点的服务器项目的packages.config. 您应该会找到类似的东西...
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)Xamarin Forms项目的packages.config.
b) The packages.config of your Xamarin Forms project.
<package id="Microsoft.Azure.Mobile.Client" version="2.0.1" targetFramework="win81" />
如果您的Microsoft.Azure.Mobile.Client版本低于2.0.0,则它不适用于Azure移动应用后端,因为zumo-api-version不包含在较旧客户端的标头中.
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.
希望这会有所帮助.
这篇关于Azure移动应用-快速入门麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!