locked
Silverlight4: silverlight can read large data from the wcf service but can not send large data to the wcf service RRS feed

  • Question

  • System

    XP, visual studio 2010, mssql, no IIS.


    I have a silverlight non asp.net client running which connects to a wcf service.


    When i try to upload a small image(2kb) as a byte[] in a column field towards the wcf service then the application works fine but when I try to send a 30kb image then I get a not found error.


    I manually added the 30Kb image into the database and when I do a read from the wcf service then the application works fine.


    So my silverlight can read large data from the wcf service but can not send large data to the wcf service.


    This is my ServiceReferences.ClientConfig

    <bindings>
                <basicHttpBinding>
                    <binding name="LargeBuffer" closeTimeout="00:01:00" openTimeout="00:01:00"
                        receiveTimeout="00:10:00" sendTimeout="00:01:00" maxBufferSize="73400320"
                        maxReceivedMessageSize="73400320">
                        <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost:1320/Service1.svc" binding="basicHttpBinding"
                    bindingConfiguration="LargeBuffer" contract="ServiceReference1.IService1"
                    name="LargeBuffer" />
            </client>


    and this is my wcf Web.config


    <bindings>
          <basicHttpBinding>
            <binding name="LargeBuffer" closeTimeout="00:01:00" openTimeout="00:01:00"
              receiveTimeout="00:10:00" sendTimeout="00:01:00" maxBufferSize="73400320"
              maxBufferPoolSize="73400320"
              maxReceivedMessageSize="73400320"
              transferMode="Buffered" messageEncoding="Mtom"
              useDefaultWebProxy="true">
              <readerQuotas maxDepth="73400320" maxStringContentLength="73400320"
                maxArrayLength="73400320" maxBytesPerRead="73400320" maxNameTableCharCount="73400320" />
              <security mode="None">
                <transport clientCredentialType="None"/>
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>

        <services />
        
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="73400320"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>


    I have also tried calling and setting the buffer setting via code....

    System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
          binding.MaxReceivedMessageSize = 2147483647; // int's max size
          binding.MaxBufferSize = 2147483647; // int's max size
          System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress("http://localhost:1320//Service1.svc");

          var proxy = new ServiceReference1.Service1Client(binding, address);      
          
          proxy.setItemImageListCompleted += new EventHandler<ServiceReference1.setItemImageListCompletedEventArgs>(proxy_setItemImageList);
          ServiceReference1.fItemImageList wcfList = fItemImageToWcfItemImage(bList);
          proxy.setItemImageListAsync(wcfList);

    Thursday, October 7, 2010 1:17 PM

Answers