2013-01-08 84 views
0

我正在使用Microsoft Sync Framework將Android設備上的Datadictionary的詳細信息與SQL Server同步。最初獲得成功以同步來自sql server的所有數據。但添加一些數據後,當點擊同步按鈕獲得以下錯誤。你能告訴我有人遇到過嗎?Microsoft Sync Framework - ServerBlob爲空錯誤

[Sync Error]:Error occurs during sync. Please check logs below. 
[Upload Change Response Error]: 500 Response: <ServiceError xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization.Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ErrorDescription>System.InvalidOperationException&#xD; serverBlob is empty&#xD; at Microsoft.Synchronization.Services.SqlProvider.SqlSyncProviderService.ApplyChanges(Byte[] serverBlob, List`1 entities)&#xD; at Microsoft.Synchronization.Services.UploadChangesRequestProcessor.ProcessRequest(Request incomingRequest)&#xD; at Microsoft.Synchronization.Services.SyncService`1.ProcessRequestForMessage(Stream messageBody)&#xD; &#xD; &#xD; </ErrorDescription></ServiceError> 

在下面的代碼,同步按鈕

this.sendRequest = function (serviceUri, successCallback, errorCallback, dir) { 

     TraceObj("[" + dir + " Request]:", serviceUri, this.dataObject()); 
     // Construct HTTP POST request 
     var xmlHttp = new XMLHttpRequest(); 
     xmlHttp.open("POST", serviceUri); 
     xmlHttp.setRequestHeader("Accept", "application/json"); 
     xmlHttp.setRequestHeader("Content-Type", "application/json"); 
     // Handle success & error response from server and then callback 
     xmlHttp.onreadystatechange = function() { 
      if (xmlHttp.readyState == 4) { 
       if (xmlHttp.status == 200) { 
        var res = new SyncFormatter(); 
        if (res.parse(xmlHttp.responseText)) { 
         TraceObj("[" + dir + " Response]:", serviceUri, res.dataObject()); 
         alert("[" + dir + " Response]:", serviceUri, res.dataObject()); 
         successCallback(res); 
         return; 
        } 
       } 
       TraceMsg("[" + dir + " Response Error]: ", xmlHttp.status + " Response: " + xmlHttp.responseText); 
       errorCallback(xmlHttp.responseText); 
      } 
     }; 
     xmlHttp.send(this.toString()); 
    }; 
} 
+0

它是第一次同步嗎?你如何在客戶端存儲blob? – JuneT

+0

@JuneT:請檢查編輯 – Ponmalar

+0

您還沒有回答我的問題......當您上傳客戶端上的數據並且服務器blob尚未初始化時,通常會在第一次同步時發生服務器blob錯誤。再次,你如何存儲你的blob並存儲初始值? – JuneT

回答

0

我發現這個問題的根本原因,當點擊我得到xmlHttp.status = 500。那就是當我從數據字典存儲獲得值時,value has the single quotes in the values so not able to load the values in webview. Now i have replaced single quotes by \'現在工作正常

相關問題