AppHarbor - Why is my <httpRuntime maxRequestQueryStringLength="XXXX"/> not working?

3.5k views Asked by At

I have a long querystring value I need to pass in (itself a questionable practice, I understand), and I am not able to get it to take effect on my Appharbor app instance.

Locally, I've made this change to my web.config and confirmed that the URL in question works locally:

<httpRuntime maxQueryStringLength="2097151"/>

And ensured that it exists in the resultant web.config post the transformation by my Web.Release.config. That said, when I push to AppHarbor, the transformation should pick it up...yet I'm still getting this exception:

The length of the query string for this request exceeds the configured maxQueryStringLength value.

Stack Trace:

at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)

Any ideas? Thanks for your help.

2

There are 2 answers

0
TimDog On BEST ANSWER

My original testing was done against Cassini (VS 2010's built-in web server). I pushed locally to IIS 7.5 and found this error:

HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.

Which appeared because I didn't specify the maxQueryLength in the <system.webServer> section of my web.config as well as the <httpRuntime>. So the answer is to specify BOTH the <system.web> and <system.webServer> sections:

<system.web>
   <httpRuntime maxQueryStringLength="2097151"/>
</system.web>

And then:

<system.webServer>
   <security>
     <requestFiltering>
       <requestLimits maxQueryString="2097151"/>
     </requestFiltering>
   </security>
</system.webServer>

When I pushed this version of my config to AppHarbor, all was well. Hope this helps.

0
DenNukem On

Remember that HTTP.SYS has its own limits as well! They're described here: http://support.microsoft.com/kb/820129