locked
Offline Synchronization via WCF. Error: "System.Net.WebException: The remote server returned an error: (400) Bad Request." RRS feed

  • Question

  • If I synchronize data using 2-tier architecture - it's Ok. But if I do it via WCF channel I have the exception.
    And this exception I have only on data uploading and if I change about 100 rows or more. If I change only few rows on client DB - it's ok. And if I only download data it's ok too.

    Exception text:
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
    at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

    I suppose that this error related with my WCF in settings. Please look bellow, may be you'll find some mistakes

    Client Config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    </configSections>
    <system.diagnostics />
    <connectionStrings>
    <add name="Client.Properties.Settings.ClientDBConnectionString"
    connectionString="Data Source=D:\Projects\SyncFrameworkPototype\ClientData\SalesWorks.sdf" />
    </connectionStrings>
    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IServiceForSync" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    maxBufferSize="6553648" maxBufferPoolSize="524288" maxReceivedMessageSize="6553648"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://localhost:8081/MyService" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IServiceForSync" contract="WcfServiceReference.IServiceForSync"
    name="BasicHttpBinding_IServiceForSync" />
    </client>
    </system.serviceModel>
    </configuration>




    Server Config:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    </configSections>
    <system.diagnostics />
    <connectionStrings>
    <add name="Client.Properties.Settings.ClientDBConnectionString"
    connectionString="Data Source=D:\Projects\SyncFrameworkPototype\ClientData\SalesWorks.sdf" />
    </connectionStrings>
    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IServiceForSync" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    maxBufferSize="6553648" maxBufferPoolSize="524288" maxReceivedMessageSize="6553648"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None"
    realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://localhost:8081/MyService" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IServiceForSync" contract="WcfServiceReference.IServiceForSync"
    name="BasicHttpBinding_IServiceForSync" />
    </client>
    </system.serviceModel>
    </configuration>

    • Moved by Hengzhe Li Friday, April 22, 2011 7:47 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, November 3, 2008 11:00 AM

All replies

  • It seems when you are trying to update many rows at the time the WCF server times out.  See if this problem goes away by modifying the WCF server WaitForReply TimeSpan.

     

    Maria del Mar Alvarez - MSFT

    Thursday, November 20, 2008 7:04 PM
  • Try increasing all timout properites and also the maxstringcontentlength,maxarraylength.  If it is peer to peer then try with small amout of data.

     

    Thursday, November 27, 2008 3:40 PM