4

edit3: i added the webconfig from the server

edit2: I ran the log and this is the error message that comes up:

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.

Since it only does this for a test of 2000records but not for a test of 200, I decided to change the app settings assuming it went over the standard limit of 65535. Unfortunately this didn't help and searching around I found that there where two other types of origins for this problem one being the settings in the service itself and one in the endpoint.

The developer making the service says his side is ok, and that the problem is just a setting on my side he once did himself but can't remember.

I've added the app config data with the endpoint people have said that if the endpoint doesn't match up there will be a default endpoint created using the default settings and thus using the 65K limit. if this is the problem how do I solve that?

If you need any extra code or information, let me know.

edit: i added the changes to the app config as suggested

<behaviors>
  <endpointBehaviors>
    <behavior name="MetadataBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>


    <binding name="BasicHttpBinding_IMailSortService" 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="524288" 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>


    <endpoint behaviorConfiguration="MetadataBehavior" address="http://remote-access/MailSort/MailSortService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService"
        contract="MailSortServiceReference.IMailSortService" name="BasicHttpBinding_IMailSortService" />

webconfig on server

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="FilePath" value="\\162.27.51.43\DOWNLOAD\RPA\Mailsort\Auto" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="2147483647" />
  </system.web>

   <system.diagnostics>
      <sources>
            <source name="System.ServiceModel" 
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
            <listeners>
               <add name="traceListener" 
                   type="System.Diagnostics.XmlWriterTraceListener" 
                   initializeData= "c:\logs\Traces.svclog" />
            </listeners>
         </source>
      </sources>
   </system.diagnostics>
  <system.serviceModel>
    <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"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>  
</configuration>
Andy
  • 2,248
  • 7
  • 34
  • 57
  • 2
    Take a look at the [maxItemsInObjectGraph](http://stackoverflow.com/questions/3425483/exception-in-returning-generic-list-from-wcf/3426621#3426621) attribute, perhaps this will help you out – Simon Wilson Mar 28 '11 at 13:34
  • i added the behavior but unfortunatly it still came with a bad request. i will look into the behavior options a bit further though, see if there is any other possibilities in there. – Andy Mar 28 '11 at 14:10
  • You do have the basicHttpBinding configured in your service's config section right? With the same maxItemsInObjectGraph and MaxRecieveivedMessageSize, etc? – Simon Wilson Apr 17 '11 at 17:13
  • Can you post detailed exception stack trace? With include faults in exception at client side also can you post signature of the method you are calling? – Akash Kava Apr 21 '11 at 06:17

3 Answers3

1

The comments were getting too big, moving into an answer:

Did you point your endpoint to the behavior?

<endpoint address="http:blah/MyService.svc" behaviorConfiguration="MyServiceBehavior". 

The current config works for 200 but not 2000? If so, could your try modifying your service binding to the max like below and see if that helps, (you would reflect the same attributes on the service end too)?

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
Simon Wilson
  • 9,929
  • 3
  • 27
  • 24
  • i had added the config to the endpoint and i had tried upping the reade quotas before with no avail. i tried them again now but it still gives me the bad request error. – Andy Mar 28 '11 at 15:37
  • i added the error i found in the log when running these changes. seems to not take my nd point information. – Andy Mar 28 '11 at 16:17
  • Are you upping them on the server side too, in the service's config? – Simon Wilson Mar 28 '11 at 16:39
  • i added the web.config to the original question, there seems to be no binding in there unlike in this other question but this is because it is c#4.0 according to the services creator. (http://stackoverflow.com/questions/784606/large-wcf-web-service-request-failing-with-400-http-bad-request) – Andy Mar 29 '11 at 08:02
  • Sorry Andy, I had the same error as you and basically took the bindings from my service's config and pasted them into my client and the error went away...hoped it would for you too. – Simon Wilson Mar 29 '11 at 11:52
0

I don't see comments enabled for this post.

Instead of commenting, I am giving an answer.

According to the below post, please make sure that you are using fully qualified namespace for the service contract.

http://forums.silverlight.net/forums/p/191589/442378.aspx

<endpoint behaviorConfiguration="MetadataBehavior" address="http://remote-access/MailSort/MailSortService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService"
        contract="FullyQualifiedNamespace.IMailSortService" name="BasicHttpBinding_IMailSortService" />
Abhilash
  • 121
  • 1
  • 7
0

the solution was the below app config setting.

When sending large messages through WCF the following code needs to be added to both the web.config on the server and the app.config on the local application. This will then get the server and local configs to use the user defined message sizes.

Include inside of section.

<protocolMapping>
<remove scheme="http" />
<add scheme="http" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailSortService" />
</protocolMapping>
Andy
  • 2,248
  • 7
  • 34
  • 57