Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a list which has 9 fields. When i pass A smaller list (say 50 rows) the application is working fine. If i pass a larger list my service is throwing the exception "The remote server returned an unexpected response: (400) Bad Request." exception. please help me solving this issue.

My Web config is as below
XML
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionstrings>
    <add name="ApplicationServices">
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />

  </add></connectionstrings>

  <system.web>
    <compilation debug="true" targetframework="4.0" />

    <authentication mode="Windows">
            <!--<forms loginUrl="~/Account/Login.aspx" timeout="2880" />-->
    </authentication>
    <identity impersonate="false" />
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionstringname="ApplicationServices">
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </add></providers>
    </membership>

    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionstringname="ApplicationServices" applicationname="/" />
      </providers>
    </profile>

    <rolemanager enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionstringname="ApplicationServices" applicationname="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationname="/" />
      </providers>
    </rolemanager>

    <httpruntime maxrequestlength="2147483647" executiontimeout="3600" />

  </system.web>

  <system.webserver>
     <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>
  <system.servicemodel>
    <behaviors>
      <endpointbehaviors>
        <behavior name="Behavior">
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
        </behavior>
      </endpointbehaviors>
    </behaviors>
    <bindings>
      <basichttpbinding>
        <binding name="BasicHttpBinding_IService1" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8"
          useDefaultWebProxy="true">
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647">
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientcredentialtype="Windows" proxycredentialtype="Windows">
              realm="" />
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_IErrorService" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8"
          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" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_ISecurityUserService" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8"
          useDefaultWebProxy="true">
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647">
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientcredentialtype="Windows" proxycredentialtype="Windows">
              realm="" />
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
      </basichttpbinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:6789/Service1.svc" binding="basicHttpBinding">
        bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
        name="BasicHttpBinding_IService1" />
      <endpoint address="http://localhost:6789/ErrorService.svc" binding="basicHttpBinding">
        bindingConfiguration="BasicHttpBinding_IErrorService" contract="ErrorServiceReference.IErrorService"
        name="BasicHttpBinding_IErrorService" />
      <endpoint address="http://localhost:6789/SecurityUserService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISecurityUserService"
        contract="SecurityUserServiceReference.ISecurityUserService"
        name="BasicHttpBinding_ISecurityUserService" />
    </endpoint></endpoint></endpoint></client>
  </system.servicemodel>
</configuration>


and my wcf config is as below
XML
<configuration>
  <connectionstrings>

    <add name="DEFAULT" connectionstring="server=DEV1;Port=52;database=UTIL;User=ara;password=me;Charset=iso_1;Connect Timeout=100" />

  </connectionstrings>
  <appsettings>
    <add key="DEFAULT_SERVER" value="UAT" />
    <add key="DEFAULT_DATABASE" value="UTIL" />
    <add key="DEFAULT_PORT" value="480" />
    <add key="DEFAULT_USER" value="fator" />
    <add key="DEFAULT_PASSWORD" value="U212ajUyODY=" />
  </appsettings>
  <system.web>
    <compilation debug="true" targetframework="4.0" />

      <httpruntime maxrequestlength="2147483647" executiontimeout="3600" />

  </system.web>
  <system.servicemodel>
    <behaviors>
      <servicebehaviors>
        <behavior name="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>

    <services>

    </services>

    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
 <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>

</configuration>


I modified my service web config with endpoint and binding as below. but still I am getting the same error
XML
<configuration>
  <connectionstrings>

    <add name="DEFAULT" connectionstring="server=DEV;Port=52;database=UTIL;User=ar;password=me3;Charset=iso_1;Connect Timeout=100" />

  </connectionstrings>
  <appsettings>
    <add key="DEFAULT_SERVER" value="UA" />
    <add key="DEFAULT_DATABASE" value="UTIL" />
    <add key="DEFAULT_PORT" value="45" />
    <add key="DEFAULT_USER" value="fr" />
    <add key="DEFAULT_PASSWORD" value="Y=" />
  </appsettings>
  <system.web>
    <compilation debug="true" targetframework="4.0" />

      <httpruntime maxrequestlength="2147483647" executiontimeout="3600" />

  </system.web>
  <system.servicemodel>
    <behaviors>
      <servicebehaviors>
        <behavior name="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" />
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
        </behavior>
      </servicebehaviors>
    </behaviors>

    <services>
      <service name="Service.Service1" behaviorconfiguration="Behavior">
        <endpoint address="">
                  binding="basicHttpBinding"
                  bindingConfiguration="BasicHttpBinding_IService1"
                  contract="Service.IService1"
                  name="BasicHttpBinding_IService1" />
        <endpoint address="mex">
                  binding="mexHttpBinding"
                  contract="IMetaDataExchange"></endpoint>
        <host>
          <timeouts opentimeout="00:30:00" />
        </host>
      </endpoint></service>
      <service name="Service.ErrorService" behaviorconfiguration="Behavior">
        <endpoint address="">
                  binding="basicHttpBinding"
                  bindingConfiguration="BasicHttpBinding_IErrorService"
                  contract="Service.IErrorService"
                  name="BasicHttpBinding_IErrorService" />
        <endpoint address="mex">
                  binding="mexHttpBinding"
                  contract="IMetaDataExchange"></endpoint>
        <host>
          <timeouts opentimeout="00:30:00" />
        </host>
      </endpoint></service>
      <service name="Service.SecurityUserService" behaviorconfiguration="Behavior">
        <endpoint address="">
                  binding="basicHttpBinding"
                  bindingConfiguration="BasicHttpBinding_ISecurityUserService"
                  contract="Service.ISecurityUserService"
                  name="BasicHttpBinding_IErrorService" />
        <endpoint address="mex">
                  binding="mexHttpBinding"
                  contract="IMetaDataExchange"></endpoint>
        <host>
          <timeouts opentimeout="00:30:00" />
        </host>
      </endpoint></service>
    </services>
    <bindings>
      <basichttpbinding>
      <binding name="BasicHttpBinding_IService1" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8"
        useDefaultWebProxy="true">
        <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647">
          maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

        <security mode="None">
          <transport clientcredentialtype="Windows" proxycredentialtype="Windows">
            realm="" />
          <message clientcredentialtype="UserName" algorithmsuite="Default" />
        </transport></security>
      </readerquotas></binding>
        <binding name="BasicHttpBinding_IErrorService" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8"
          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" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_ISecurityUserService" closetimeout="00:20:00">
        openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8"
          useDefaultWebProxy="true">
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647">
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientcredentialtype="Windows" proxycredentialtype="Windows">
              realm="" />
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
      </basichttpbinding>
    </bindings>
    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
 <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>

</configuration>

I guess The endpoint and the binding i defined explicitly are not getting used by the service. please correct me if i have configured The service wrong
Posted
Updated 17-Apr-13 2:56am
v3
Comments
Bernhard Hiller 18-Apr-13 3:03am    
Are you sure that it is due to the amount of data? What about an entry in the list which causes the problems?

1 solution

Dude if you are using entity framework disable lazy loading then it should work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900