Azure脱机同步不提取任何内容
我在运行这个脱机同步客户端时遇到了很多问题。现在它什么都没拉,我一辈子也弄不明白为什么!以下是我在客户端上的同步代码:Azure脱机同步不提取任何内容,azure,azure-mobile-services,Azure,Azure Mobile Services,我在运行这个脱机同步客户端时遇到了很多问题。现在它什么都没拉,我一辈子也弄不明白为什么!以下是我在客户端上的同步代码: private async Task InitLocalStoreAsync() { if (!App.MobileService.SyncContext.IsInitialized) { var store = new MobileServiceSQLiteStore("localstore.db");
private async Task InitLocalStoreAsync()
{
if (!App.MobileService.SyncContext.IsInitialized)
{
var store = new MobileServiceSQLiteStore("localstore.db");
store.DefineTable<clist>();
await App.MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());
}
await SyncAsync();
await RefreshNcards();
}
private async Task SyncAsync()
{
String errorString = null;
PullOptions pageSize = new PullOptions { MaxPageSize =1000 };
try
{
await LocalCards.PullAsync("clist", LocalCards.CreateQuery(),pullOptions:pageSize); // first param is query ID, used for incremental sync
}
catch (Exception ex)
{
errorString = "It look's like we weren't able to make sure your cards were updated. No worries, next time you start the app we will try again. This won't impact your experience.";
// errorString = "Pull failed: " + ex.Message +
// "\n\nIf you are still in an offline scenario, " +
// "you can try your Pull again when connected with your Mobile Serice.";
}
if (errorString != null)
{
MessageDialog d = new MessageDialog(errorString);
await d.ShowAsync();
}
}
为了以防万一,我在Azure门户中运行日志时得到的日志流在这里很有用
2016-04-13 04:36:05~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=d9ceb9a8-433f-4a23-a4ab-3caf984cb8e8 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0+Safari/537.36+Edge/13.10586阵列特性=6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522131849magichub.scm.azurewebsites.net 200 0 914 1625 11874
2016-04-13 04:36:26~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=159b6aa0-df2e-46a8-8a24-d0a086acdaf 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.2486.0+Safari/537.36+Edge/13.10569696Arraffinity=CCC2908c468c4da878a868b388c45a868c45a788a+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522152216magichub.scm.azurewebsites.net 200 0 584 1626 20039
2016-04-13 04:36:46~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=e7c12e75-54a8-4be3-9e66-7399635657f6 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0.0+Safari/537.36+Edge/13.10569Arraffinity=5.8c468c458c468c4dea868b878c45a868f168b8c45a878c41f8bj+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522164231magichub.scm.azurewebsites.net 200 0 584 1625 20065
2016-04-13 04:37:06~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=c78b53c1-15d8-491b-8c6b-22d8239fd920443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0.0+Safari/537.36+Edge/13.105696Arraffinity=CC908c468c458b388c45a868c4141f168a868b388c45a868c41f168c45a87a+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522184449magichub.scm.azurewebsites.net 200 0 584 1625 20027
2016-04-13 04:37:26~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=a5e45861-bedd-4162-bc88-373306825e85 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0.0+Safari/537.36+Edge/13.10586 ARRAffinity=69C210Fd768c468c468c458a868b388c45a868b388a186a+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522204509magichub.scm.azurewebsites.net 200 0 584 1625 20052
2016-04-13 04:37:46~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=90f17ac1-2516-4bf8-ba9b-470fa1bf7748 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0.0+Safari/537.36+Edge/13.10586 ARRAffinity=C210f16768c468f168b878a868c458c458a878c414dea+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522224587magichub.scm.azurewebsites.net 200 0 584 1625 20023
2016-04-13 04:38:06~1MAGICHUB POST/dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=f715514e-f0aa-4299-950a-88b1884d89bf 443-172.103.28.93 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2486.0+Safari/537.36+Edge/13.10586 ARRAffinity=C26910CF768B1968C58B1868B1868C5878BF+__RequestVerificationToken=ded78fdc-d9b2-49ad-bb5b-3a791b4a6886+ai_user=3MLsg | 2016-04-13T03:47:20.208Z+ai_session=r6fjd12405192403331240522244667magichub.scm.azurewebsites.net 200 0 584 1625 20056
2016-04-13 04:38:13 MAGICHUB GET/tables/clist$filter=(更新日期为%20ge%20datetimeoffset'1970-01-01T00%3A00%3A00.0000000%2B00%3A00')和$orderby=updatedAt&$skip=0&$top=1000&$INCLUDELEDEDELEDETED=true和$filter=(更新日期为%20ge%20datetimeoffset'1970-01-01T00%3A00%3A00%3A00%3A00.0000000%2B00'))&$orderby=updatedAt&$skip=0&$top=1000&uu includeDeleted=true&X-ARR-LOG-ID=c6b2681c-2dbe-4452-8c49-367343c36655-443-172.103.28.93 ZUMO/2.0+(lang=Managed;+os=Windows+Store;+os\u版本=-->+arch=X64;+version=2.0.31125.0)---magichub.azurewebsites.net 200 0 0 695 1286 93
我完全被难住了,为什么这不起作用,如果有人能帮我缩小罪魁祸首的范围并让它起作用,我会很生气 您的模型中有几个错误 系统属性需要调用
createdAt
,updatedAt
-这些属性不再有下划线。version
字段应该是字符串,而不是日期时间。Id字段应大写
您依赖于PullAsync为您执行缓存推送。您应该明确这一点,并执行PushAsync()
您没有提供LocalCards的定义,但请确保它是由
client.GetSyncTable()
获取的IMobileServiceSyncTable
的实例。您的模型中有几个错误
系统属性需要调用createdAt
,updatedAt
-这些属性不再有下划线。version
字段应该是字符串,而不是日期时间。Id字段应大写
您依赖于PullAsync为您执行缓存推送。您应该明确这一点,并执行PushAsync()
您没有提供LocalCards的定义,但请确保它是的实例<
class clist : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
[JsonProperty(PropertyName ="id")]
public string id { get; set; }
[JsonProperty(PropertyName = "_createdAt")]
public DateTime _createdAt { get; set; }
[JsonProperty(PropertyName = "_updatedAt")]
public DateTime _updatedAt { get; set; }
[JsonProperty(PropertyName = "_version")]
public DateTime _version { get; set; }
public bool _deleted { get; set; }
[JsonProperty(PropertyName = "Nid")]
public string Nid { get; set; }
[JsonProperty(PropertyName = "Nname")]
public string Nname { get; set; }
[JsonProperty(PropertyName = "Nset")]
public string Nset { get; set; }
public void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}