2012-01-19 33 views
3

我有一個很長的querystring值,我需要通過(本身是一個可疑的做法,我明白),我不能讓它在我的Appharbor應用程序實例上生效。AppHarbor - 爲什麼我的<httpRuntime maxRequestQueryStringLength =「XXXX」/>不工作?

在本地,我做了這個改變我的web.config並證實有問題的URL本地工作:

<httpRuntime maxQueryStringLength="2097151"/> 

,並確保它在最終web.config中存在通過發佈我的改造Web.Release.config。這就是說,當我推到AppHarbor,轉型應該把它撿起來......但我仍然得到此異常:

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

堆棧跟蹤:

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

任何想法?謝謝你的幫助。

+0

如果你已經把設置放在你的主web.config文件中,爲什麼你還在用web.release.config做什麼?無論如何,您可能需要檢查組合是否提供了所需的輸出:webconfigtransformationtester.apphb.com – friism

+0

對不起,措辭嚴厲 - 通過「確保它存在於我的Web.Release.config中」我確實意味着我確保導致轉換後的web.config保留了我期望的段。我編輯了原始問題。 – TimDog

回答

6

我原來的測試是針對卡西尼(VS 2010的內置web服務器)完成的。我在當地推到IIS 7.5,發現這個錯誤:

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

這似乎是因爲我沒有在我的web.config的<system.webServer>部分指定maxQueryLength還有<httpRuntime>。所以答案是同時指定<system.web><system.webServer>部分:

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

然後:

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

當我把這個版本我的config來AppHarbor的,一切都很好。希望這可以幫助。

相關問題