Large Databases won't Sync Properly

Jun 5, 2014 at 10:15 PM
I have a number of SQLite databases of sizes varying from 10 to 50 megabytes, but when the databases become larger than about 30 megabytes they fail to sync. The error I get is a WebException that indicates there is a 404 error. The stack trace I get is the following:

System.Xml.XmlException: JsonEncounteredUnexpectedCharacter
at Microsoft.Synchronization.ClientServices.XmlJsonReader.ReadAttributes()
at Microsoft.Synchronization.ClientServices.XmlJsonReader.ReadNonExistentElementName(StringHandleConstStringType elementName)
at Microsoft.Synchronization.ClientServices.XmlJsonReader.Read()
at System.Xml.XmlReader.ReadToDescendant(String name)
at Microsoft.Synchronization.ClientServices.HttpCacheRequestHandler.<ProcessRequest>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.Synchronization.ClientServices.HttpCacheRequestHandler.<ProcessCacheRequestAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at Microsoft.Synchronization.ClientServices.CacheController.<EnqueueUploadRequest>d__a.MoveNext()

The JSON response I get from the server is the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>404 - File or directory not found.</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} --> </style> </head> <body>
<div id="header"><h1>Server Error</h1></div> <div id="content"> <div class="content-container"><fieldset> <h2>404 - File or directory not found.</h2> <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3> </fieldset></div> </div> </body>
</html>

Any ideas about what is going on here? Is the sync taking too long and it tries to get a response too soon or is something else going wrong?
Jun 5, 2014 at 10:19 PM
By the way, here is the config xml file that the server is using:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />

<httpRuntime targetFramework="4.5" />
</system.web>
<connectionStrings>
<add name="ConnName" connectionString="Data Source=databasename;Initial Catalog=DBNAme;User Id=UserName;Password=Password;" />
</connectionStrings>
<system.webServer>
    <defaultDocument>
        <files>
            <add value="fdasyncservice.svc" />
        </files>
    </defaultDocument>
</system.webServer>
          <system.diagnostics>
                          <switches>

                                         <add name="SyncTracer" value="4" />
                          </switches>

                          <trace autoflush="true">
                                         <listeners>
                                                        <add name="TestListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TraceSample.log"/>
                                         </listeners>
                          </trace>
           </system.diagnostics>


           <system.serviceModel>
                          <bindings>
                             <webHttpBinding>
                                         <binding closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"  />
                             </webHttpBinding>
                          </bindings>
           </system.serviceModel>
</configuration>
Coordinator
Jun 6, 2014 at 10:06 AM
Do you have used the BatchSize ?
            // Because my json may be huge, i enable the batch mode
            config.SetDownloadBatchSize(2 * 1024);
If yes, can you send me a repro ?
Jun 6, 2014 at 8:03 PM
Sorry, I am kind of new to this, but where do I set that property? I am assuming it is in the client code, but exactly where can I call that from? Would I call it in my code or do I have to modify some of the library files?
Jun 6, 2014 at 8:36 PM
So I found where I can set the property in the server code but it was already set to have a batch size of 2 * 1024. What else could be causing this problem?
Coordinator
Jun 9, 2014 at 9:49 AM
I Dont know
Can you send me your database and solution ?
Jun 10, 2014 at 10:49 PM
I found the solution on another forum. Apparently you can't get the server to accept databases bigger than 30 megabytes without the following code in the web.config xml file:

<system.webServer>
<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="524288000"/>
  </requestFiltering>
</security>
<validation validateIntegratedModeConfiguration="false" />
<asp>
  <limits maxRequestEntityAllowed="2147483647" bufferingLimit="2147483647" />
</asp>
</system.webServer>