Large WCF web service request failing with (400) HTTP Bad Request

后端 未结 9 1589
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 03:30

I\'ve encountered this apparently common problem and have been unable to resolve it.

If I call my WCF web service with a relatively small number of items in

相关标签:
9条回答
  • 2020-11-28 04:08

    Just want to point out

    Apart from MaxRecivedMessageSize, there are also attributes under ReaderQuotas, you might hit number of items limit instead of size limit. MSDN link is here

    0 讨论(0)
  • 2020-11-28 04:11

    In my case, it was not working even after trying all solutions and setting all limits to max. In last I found out that a Microsoft IIS filtering module Url Scan 3.1 was installed on IIS/website, which have it's own limit to reject incoming requests based on content size and return "404 Not found page".

    It's limit can be updated in %windir%\System32\inetsrv\urlscan\UrlScan.ini file by setting MaxAllowedContentLength to the required value.

    For eg. following will allow upto 300 mb requests

    MaxAllowedContentLength=314572800

    Hope it will help someone!

    0 讨论(0)
  • 2020-11-28 04:12

    In the server in .NET 4.0 in web.config you also need to change in the default binding. Set the follwowing 3 parms:

     < basicHttpBinding>  
       < !--http://www.intertech.com/Blog/post/NET-40-WCF-Default-Bindings.aspx  
        - Enable transfer of large strings with maxBufferSize, maxReceivedMessageSize and maxStringContentLength
        -->  
       < binding **maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"**>  
          < readerQuotas **maxStringContentLength="2147483647"**/>            
       < /binding>
    
    0 讨论(0)
提交回复
热议问题