0

I have WCF hosted under website application at IIS. Below is service declarations in web.config

<system.serviceModel>
    <services>
<service  name="Emp.Depart.Handle">
        <endpoint behaviorConfiguration="HandleBehavior" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IHandle"
           contract="Emp.Depart.IHandle" />
      </service>
    </services>
<behaviors>
      <endpointBehaviors>
<behavior name="HandleBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="HandleBehaviors">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
          <basicHttpBinding>
    <binding name="BasicHttpBinding_IHandle" 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"
              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>
</system.serviceModel>

Despite of the previous declarations i got the error :

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

when trying to connect from client, cofig of client is as follows :

<basicHttpBinding>
                <binding name="BasicHttpBinding_Ihl7" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
                        maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>

I can't identify the cause of the problem, i searched and increased maxRecievedMessage but nothing happened.

Please advice.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Ahmy
  • 5,420
  • 8
  • 39
  • 50
  • 1
    you can enable wcf tracing to get more information. http://msdn.microsoft.com/en-us/library/ms733025.aspx – mehdi.loa Oct 02 '14 at 16:26
  • I cant see "address" in your endpoint... – Karthik Ganesan Oct 02 '14 at 16:27
  • 400 is a tricky one to pin down, it could be a number of things. The remote server is receiving the request, it just cannot determine what it is meant to do with it. Are you serializing objects and sending them over the wire? Try seeing exactly what you are calling, using Tracing as above, Fiddler etc. – dyson Oct 02 '14 at 16:35
  • I enabled WCF tracing but i can't extract anything from output!! how can i get the cause of the error? The client is calling method in the service expecting 2 string parameters, the client is sending data 1.5 MB to the method – Ahmy Oct 02 '14 at 16:40
  • I found the following exception message : 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. – Ahmy Oct 02 '14 at 16:43
  • how can i solve this issue please?? @mehdi.loa Karthik Ganesan – Ahmy Oct 02 '14 at 17:09
  • @ barrick please advice – Ahmy Oct 02 '14 at 17:10
  • 1
    @Ahmy what is address set to in endpoint ? did you try to run just the service? – Karthik Ganesan Oct 02 '14 at 18:35
  • @Ahmy in your server side config file try to set – Khurram Ali Oct 02 '14 at 19:57
  • @Ahmy: Add more detail in your question your calling method + where are you getting this Exception " The maximum message size quota for incoming messages (65536) has been exceeded" – Khurram Ali Oct 02 '14 at 20:00

1 Answers1

0

not nice and also strange way, but removing the name of the configuration may work bases on: WCF service maxReceivedMessageSize basicHttpBinding issue

also these could be useful: how to increase MaxReceivedMessageSize when calling a WCF from C#

http://msdn.microsoft.com/en-us/library/ee358768.aspx/

Community
  • 1
  • 1
mehdi.loa
  • 579
  • 1
  • 5
  • 23