views:

32

answers:

5

I have a silverlight app (non asp) and wcf service.

When i read large data from the wcf service 60k+ then the silverlight app successfully retrieves the information from the wcf service. However.... When i try to send (silverlight client to wcf service) large data 30k+ I get the XmlDictionaryReaderQuotas error but when I send 2k information then everything works fine.

This is my ServiceReferences.ClientConfig file

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:1320/Service1.svc"
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService1"
                contract="ServiceReference1.IService1"
                name="LargeBuffer" />
        </client>
    </system.serviceModel>

And this is my wcf service app.config file....

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="LargeBuffer" closeTimeout="00:01:00"
          openTimeout="00:01:00"
          receiveTimeout="00:10:00"
          sendTimeout="00:01:00"
          transferMode="Buffered"
          maxReceivedMessageSize="73400320" >
          <!--70MB-->
          <readerQuotas maxArrayLength="73400320" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services />
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
+1  A: 

If you are using byte array to pass back some values, have a look here:

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

You need to set maxArrayLength to a high value. This is the most likely reason that your call does not succeed and it is usually set to a low value (8192 I think).

UPDATE

Put this under the <~~~binding> element:

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
              maxArrayLength="2147483647" maxBytesPerRead="2147483647"
              maxNameTableCharCount="2147483647" />

Not just maxArrayLength but change all others as well. This needs to be in both sides. This should work...

Aliostad
Q continued...This is my ServiceReferences.ClientConfig file
Mat
Yes, I am using byte[] array's.
Mat
See my update...
Aliostad
In the silverlight client I am unable to add the <readerQuotas/> to theServiceReferences.ClientConfig file. It says that it is a Invalid child element. So it doesn't work.
Mat
Where are you adding it to? Update your question. It needs to be under <bindings> <basicHttpBinding> <binding ...>
Aliostad
Mat
A: 

Q continued...

This is my ServiceReferences.ClientConfig file

<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:1320/Service1.svc"
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService1"
                contract="ServiceReference1.IService1"
                name="LargeBuffer" />
        </client>
    </system.serviceModel>

And this is my wcf service app.config file....

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="LargeBuffer" closeTimeout="00:01:00"
          openTimeout="00:01:00"
          receiveTimeout="00:10:00"
          sendTimeout="00:01:00"
          transferMode="Buffered"
          maxReceivedMessageSize="73400320" >
          <!--70MB-->
          <readerQuotas maxArrayLength="73400320" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services />
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  <system.serviceModel/>
Mat
Sorry, trying to post my config files but for somereason this site won't show them?
Mat
First don't create new post for each addition. Edit your question. Second when you are posting code or XML you have to select it and mark it as a code (101010 icon).
Ladislav Mrnka
A: 

This is my ServiceReferences.ClientConfig file

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:1320/Service1.svc"
            binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IService1"
            contract="ServiceReference1.IService1"
            name="LargeBuffer" />
    </client>
</system.serviceModel>
Mat
A: 

And this is my wcf service app.config file....

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="LargeBuffer" closeTimeout="00:01:00"
      openTimeout="00:01:00"
      receiveTimeout="00:10:00"
      sendTimeout="00:01:00"
      transferMode="Buffered"
      maxReceivedMessageSize="73400320" >
      <!--70MB-->
      <readerQuotas maxArrayLength="73400320" />
    </binding>
  </basicHttpBinding>
</bindings>
<services />
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Mat
+1  A: 

I have probably answered same question on MSDN but user names are different. I think your configuration is not used because on server you are defining new named BasicHttpBinding configuration but you don't use it in any service. So define service with endpoint referencing this configuration or try to remove name from binding configuration.

Ladislav Mrnka