Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

WCF BufferSize RSS

3 replies

Last post Apr 08, 2008 09:50 AM by Allen Chen – MSFT

(0)
  • nirav_2052003

    nirav_2052003

    Participant

    794 Points

    206 Posts

    WCF BufferSize

    Apr 03, 2008 04:52 AM | LINK

     Hello, Am using a webservice to Upload image on the server. Am successfully able to upload .png image but not being able to upload a jpg image.

    I found from one of forum that it requires set one of that property of Binding class object programatically. but the problem is binding object doesn't have that propert. That propert is MaxBufferSize. It can be seen in ServiceConfiguration file. setting the value there doesn't work because silverlight does not read from that file. 

    Mark as "Answered" if this answers your question
    Regards,
    Nirav Patel,
    Software Engineer
    My Blog
    LinkedIn
  • mchlSync

    mchlSync

    Star

    14968 Points

    2799 Posts

    Re: WCF BufferSize

    Apr 03, 2008 05:53 AM | LINK

     Have you tried using this sample and that sample?

    1. UploadServiceReference.UploadClient UploadServiceClient = null;  
    2.   
    3. System.ServiceModel.BasicHttpBinding Binding = new BasicHttpBinding(BasicHttpSecurityMode.None);  
    4.   
    5. Binding.MaxBufferSize = 2000000;  
    6. Binding.MaxReceivedMessageSize = 2000000;

    1. <bindings>  
    2. <basicHttpBinding>  
    3. <binding name="ServicesBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">  
    4. <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>  
    5. </binding>  
    6. </basicHttpBinding>  
    7. </bindings>

     

    (If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

    Regards,
    Michael Sync
    Silverlight MVP

    Blog : http://michaelsync.net
  • nirav_2052003

    nirav_2052003

    Participant

    794 Points

    206 Posts

    Re: Re: WCF BufferSize

    Apr 03, 2008 06:59 AM | LINK

    I have tried with the solution you provide but still it is throwing some expection whenever i try to upload a large file. When i debug with large size buffer it is not reaching server side code. The error is:

    An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code

    Additional information: [UnexpectedHttpResponseCode]
    Arguments:Not Found
    Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30223.0&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode
     

    Mark as "Answered" if this answers your question
    Regards,
    Nirav Patel,
    Software Engineer
    My Blog
    LinkedIn
  • Allen Chen – MSFT

    Allen Chen –...

    Star

    14215 Points

    1854 Posts

    Microsoft

    Re: Re: WCF BufferSize

    Apr 08, 2008 09:50 AM | LINK

    Hi:

      May it caused by server side restriction? Try to add this to Web.config of the WCF project (IIS host) to see if it works:

    <system.web>
     <httpRuntime maxRequestLength="1000000" executionTimeout="2000" />
    </system.web>

    Regards

     

    Sincerely,
    Allen Chen
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.