none
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

    Question

  • This is my first WCF service. The error that I got on client side was

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

    So I enabled the tracing and this is my error:-

    The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

     

    Here are my config files:-

    WCF config:-

    <?xml version="1.0" encoding="utf-8"?>
    
    <configuration>
    
     <system.diagnostics>
    
     <sources>
    
     <source name="System.ServiceModel"
    
      switchValue="Information, ActivityTracing"
    
      propagateActivity="true">
    
     <listeners>
    
      <add name="traceListener"
    
      type="System.Diagnostics.XmlWriterTraceListener"
    
      initializeData= "c:\Traces.svclog" />
    
     </listeners>
    
     </source>
    
     </sources>
    
     </system.diagnostics>
    
    
    
     <system.web>
    
     <httpRuntime maxRequestLength="2147483647" />
    
     <compilation debug="true" strict="false" explicit="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="BasicHttpBinding_ICACashDataExport" 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>
    
    
    
     <services >
    
     <service name ="CACAshDataExport">
    
     <endpoint address ="http://localhost:4031/CACashDataExport.svc" binding ="basicHttpBinding" contract ="ICACashDataExport" bindingConfiguration ="BasicHttpBinding_ICACashDataExport"></endpoint>
    
     </service>
    
     </services>
    
     <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>
    
     

     

    Web.config on client :-

    <system.serviceModel>
    
     <bindings>
    
     <basicHttpBinding>
    
     <binding name="BasicHttpBinding_ICACashDataExport" 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:4031/CACashDataExport.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICACashDataExport" contract="svcCACashDataExport.ICACashDataExport" name="BasicHttpBinding_ICACashDataExport" />
    
     </client>
    
     </system.serviceModel>

     

    Tuesday, August 23, 2011 5:23 PM

Answers

  • I suspect your service is not using its configuration, please try the following:

    1. change the binding from basicHttpBinding to wsHttpBinding

    2. create a client application (console) and add a service reference to the service

    3. validate that the generated app.config includes a client endpoint that uses wsHttpBinding

     

    If my assumption is correct the endpoint will still use basicHttpBinding


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof
    • Marked as answer by schauhan Sunday, August 28, 2011 1:38 PM
    Sunday, August 28, 2011 4:31 AM

All replies

  • I think you have a problem with the way you declared the service's configuration (the service's name attribute).

    Please read the following blog post for more information:

    http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/04/wcf-configuration-using-the-correct-service-name.aspx


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof
    Tuesday, August 23, 2011 7:54 PM
  • That didnot help.

    my srevice name is fine. I donot have any namespaces.

    Thursday, August 25, 2011 3:17 PM
  • I suspect your service is not using its configuration, please try the following:

    1. change the binding from basicHttpBinding to wsHttpBinding

    2. create a client application (console) and add a service reference to the service

    3. validate that the generated app.config includes a client endpoint that uses wsHttpBinding

     

    If my assumption is correct the endpoint will still use basicHttpBinding


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof
    • Marked as answer by schauhan Sunday, August 28, 2011 1:38 PM
    Sunday, August 28, 2011 4:31 AM