【发布时间】:2016-04-13 04:42:38
【问题描述】:
我在运行此离线同步客户端时遇到了问题。现在它什么都没有,我一辈子都无法弄清楚为什么!这是我在客户端上的同步代码:
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();
}
}
此代码暂停几秒钟,然后继续运行,没有抛出任何错误。这是我的课:
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));
}
}
}
我在 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+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc -d9b2-49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522131849https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.scm 1028 97 41.scm.scm 1028914.net 2016-04-13 04:36:26 ~1MAGICHUB POST /dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=159b6aa0-df2e-46a8-8a24-d0a0086acdaf 443 - 172.103.28.93 Mozilla/5.0+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522152216 https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 2620 2 2620 2 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+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522164231https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 26252006541 262520 2016-04-13 04:37:06 ~1MAGICHUB POST /dev/api/events/wwwroot/longpoll X-ARR-LOG-ID=c78b53c1-15d8-491b-8c6b-22d8239fd920 443 - 172.103.28.93 Mozilla/5.0+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522184449https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 2620 20 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+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522204509 https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 26252005241 262520 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+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522224587https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 262520 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+(视窗NT + + 10.0 + Win64的; + 64)+为AppleWebKit / 537.36 +(KHTML,+等+壁虎)+镀铬/ 46.0.2486.0 + Safari浏览器/ 537.36 +边沿/ 13.10586 ARRAffinity = 6910fd768a90c2d11e23085af4d93c48a8cc9617be87c545bc1e82b0186ea1da; + __ RequestVerificationToken = ded78fdc-d9b2- 49ad-bb5b-3a791b4a6886;+ai_user=3MLsg|2016-04-13T03:47:20.208Z;+ai_session=R6FJD|1460519240333|1460522244667 https://magichub.scm.azurewebsites.net/dev/wwwroot/tables/clist.jsmagichub.scm.azurewebsites.net 2620 200564 1 262520 2016-04-13 04:38:13 MAGICHUB GET /tables/clist $filter=(updatedAt%20ge%20datetimeoffset'1970-01-01T00%3A00%3A00.0000000%2B00%3A00')&$orderby=updatedAt&$skip =0&$top=1000&__includeDeleted=true&$filter=(updatedAt%20ge%20datetimeoffset'1970-01-01T00%3A00%3A00.0000000%2B00%3A00')&$orderby=updatedAt&$skip=0&$top=1000&__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_version=--;+arch=X64;+version =2.0.31125.0)--magichub.azurewebsites.net 200 0 0 695 1286 93
我完全不知道为什么这不起作用,如果有人能帮助我缩小罪魁祸首并让它起作用,我会很高兴!
【问题讨论】:
标签: azure azure-mobile-services