2

When the object is small I have this exception

An error occurred while updating the entries. See the inner exception for details

and when the object is big I have this exception

The remote server returned an unexpected response: (400) Bad Request

Client : app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService11" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                    maxReceivedMessageSize="2147483647" messageEncoding="Text"
                    textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:10965/Service1.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService11" contract="ServiceReference2.IService1"
                name="BasicHttpBinding_IService11" />
        </client>
    </system.serviceModel>
</configuration>

WCF : web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
      <httpRuntime maxRequestLength="2147483647" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>

  <system.serviceModel>
      <bindings>
          <basicHttpBinding>
              <binding name="customBinding" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"
                     maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="Buffered"
                     messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="true" useDefaultWebProxy="true" >
                  <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647"/>
              </binding>
          </basicHttpBinding>
      </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />

        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <connectionStrings><add name="SASPEEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=SASPE;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /><add name="SASPEEntities1" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=SASPE;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /><add name="SASPEEntities2" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=SASPE;integrated security=True;pooling=False;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>


</configuration>

and wcf: web.debug.config

<?xml version="1.0"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

    <system.serviceModel>
        <services>
            <service name="WcfService1.Service1">
                <endpoint address="http://localhost:10965/Service1.svc?wsdl"
                    binding="basicHttpBinding"  bindingConfiguration="customBinding" contract="WcfService1.IService1"  />
            </service>
        </services>
    </system.serviceModel>
</configuration>
Gert Arnold
  • 105,341
  • 31
  • 202
  • 291

1 Answers1

0

The error "An error occurred while updating the entries. See the inner exception for details" I see often when I have an issue with entity framework communicating with my database (column mismatches or overflows, etc...) If you execute the code that your WCF-exposed class is calling wihtout going through WCF you should be able to peek at the inner exception and find out what EF doesn't like about your database.

The 400 bad request when large data is being passed looks a lot like the issue described here-

Large WCF web service request failing with (400) HTTP Bad Request

Community
  • 1
  • 1
chrispy
  • 88
  • 1
  • 5