设置JArray值无效键值:"版本&QUOT ;. INT32数组索引预期 [英] Set JArray values with invalid key value: "version". Int32 array index expected

查看:3653
本文介绍了设置JArray值无效键值:"版本&QUOT ;. INT32数组索引预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用天蓝色的移动服务与线下同步选项创建的。一切都在开始工作的罚款。我插入几行,我又回到了我的应用程序几天后,当我试图执行一个插入我的表。我收到错误消息,因为

I created with offline sync option using azure mobile services. Everything worked fine at the beginning. I inserted several rows and I came back to my app after couple of days when I tried to make an insert into my table. I am getting the error message as

System.ArgumentException: Set JArray values with invalid key value: "version". Int32 array index expected.
  at Newtonsoft.Json.Linq.JArray.set_Item (System.Object key, Newtonsoft.Json.Linq.JToken value) [0x00028] in <filename unknown>:0 
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable.GetJTokenFromResponse (Microsoft.WindowsAzure.MobileServices.MobileServiceHttpResponse response) [0x00035] in <filename unknown>:0 
  at Microsoft.WindowsAzure.MobileServices.MobileServiceTable+<>c__DisplayClass14+<<InsertAsync>b__13>d__16.MoveNext () [0x000f7] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---

我试着版本属性在我todoitem.cs添加如下

I tried to add the version property as below in my todoitem.cs

    [Version]
    public byte[] Version { get; set; }

    [TimeStamp]
    public byte[] Version { get; set; }

但无论情况下帮助了我。我只得到了错误,当我尝试插入。读取数据只是罚款。是不是希望我设置的东西。我认为这是一个新的行插入时自动分配的,仅用于服务器和客户端之间的数据行版本之间的验证。

But neither cases helped me. I get the error only when I try to insert. reading data is just fine. Is it expecting me to set something. I thought that it is assigned automatically during a new row insert and used only to verify between row version of data between server and client.

更新:我改变了它的工作之后,我改变了架构权限为验证的用户只有每个行动,还增加了身份验证与谷歌,之后我不断收到此错误无论我做什么。我打扫桌子上的本地SQLite和蔚蓝的,但它没有,甚至帮助。

UPDATE: what I changed was after it was working, I changed the schema permissions to "Authenticated users only" for each actions and also added an authentication with google and after that I was keep getting this error whatever I do. I cleaned table on local sqlite and azure but it didnt even help.

推荐答案

最后挣扎的几乎整个2天我找出问题。我不得不使用https在我mobileApiUrl同时创造MobileServiceClient。这是工作的罚款之前,我没有使用的插入和更新任何身份验证,但一旦我用谷歌和Facebook添加验证,我开始收到此错误,虽然读了查询仍在工作。我不知道什么是它背后的原因,但从http更改为https像一个魅力的工作。

Finally struggling almost entire 2 days I figure out the problem. I had to use https in my mobileApiUrl while creating MobileServiceClient. This was working fine before I didnt use any authentication on insert and update but once I add authentication with google and facebook, I started getting this error although read queries were still working. i dont know what is the reason behind it but changing from http to https worked like a charm.

  MobileService = new MobileServiceClient(Url);

这篇关于设置JArray值无效键值:&QUOT;版本&QUOT ;. INT32数组索引预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆