Microsoft Sync Framework - ServerBlob为空错误

时间:2013-01-08 05:25:23

标签: android microsoft-sync-framework data-dictionary

我正在使用Microsoft Sync Framework将Android设备上Datadictionary的详细信息与SQL Server同步。最初成功同步来自sql server的所有数据。但是在添加一些数据并单击同步按钮后会出现以下错误。你能告诉我有没有人遇到过这个?

[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>

在下面的代码中,点击“同步”按钮时,我得到xmlHttp.status = 500

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());
    };
}

1 个答案:

答案 0 :(得分:0)

我找到了问题的根本原因。那是我从datadictionary存储中获取值value has the single quotes in the values so not able to load the values in webview. Now i have replaced single quotes by \'的时候。 现在正常工作