Maximum default POST request size of IIS 7 - how to increase 64kB/65kB limit?

前端 未结 2 1413
攒了一身酷
攒了一身酷 2020-12-03 14:17

I have created a RESTful POST web service in ASp .net C# with IIS hosting the service.

My service accepts an XML file as input and when the size exceeds 65KB I get t

相关标签:
2条回答
  • 2020-12-03 14:33

    Have you tried adding the following to your web.config?

    <system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="1000000" />
        </requestFiltering>
    </security>
    <system.webServer>
    

    This will bump up your allowed content length to a megabyte. Also, you may want to set the maxReceivedMessageSize attribute of your WCF bindings to more than the default 64k:

    <webHttpBinding>
        <binding name="MessageSizeWeb" maxReceivedMessageSize="2147483647" />
    </webHttpBinding>
    
    0 讨论(0)
  • 2020-12-03 14:38

    John Källén's answer was correct, but in my case I had an end point defined so setting the maxReceivedMessageSize had to be as follows:

    <standardEndpoints>
        <webHttpEndpoint>
            <standardEndpoint name="" 
                             helpEnabled="true" 
                             automaticFormatSelectionEnabled="true"                   
                             maxReceivedMessageSize="2147483647">
            </standardEndpoint>
        </webHttpEndpoint>
    </standardEndpoints>
    
    0 讨论(0)
提交回复
热议问题