2017-04-03 119 views
0

我在Azure應用服務上部署了NodeJS應用程序。 做了一條信息的38 MB文件我得到一個404錯誤,但引擎蓋下有一個IIS問題"Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value."Azure應用服務IIS「maxRequestLength」設置

要設置「maxAllowedContentLength」我需要編輯「的web.config」文件。

這不好,因爲如果我在Azure門戶應用程序設置上做了一些更改,我的本地版本web.config'與自動生成的文件發生衝突。

是否可以用不同的方式設置'maxAllowedContentLength'?

+2

將maxAllowedContentLength作爲Azure門戶中的應用程序設置添加時存在什麼問題? – Aram

+0

正是如此,但據我所知尚未作爲Azure門戶應用程序設置中的選項存在 – Toto

+0

編輯自動生成的** web.config **可以設置閾值。感謝Fred – Toto

回答

0

「在Web服務器上配置請求篩選以拒絕請求,因爲內容長度超過配置的值。」

據我所知,maxAllowedContentLength的默認值是30000000(約28.6MB)。我們可以connecting to a Windows Azure Website from IIS Manager with remote administration,然後我們可以找到這樣的請求限制。

enter image description here

所以,當你發佈有關38MB數據的請求將失敗。在我這邊,我增加了web.config中maxAllowedContentLength的值,我可以從我的Web API發佈大於28.6MB的數據。

<security> 
    <requestFiltering> 
    <requestLimits maxAllowedContentLength="<valueInBytes>"/> 
    </requestFiltering> 
</security> 

請求我的Web API:

enter image description here

您可以配置/在你當地的web.config修改maxAllowedContentLength屬性,並使用web.config中您的應用程序部署到Azure的網站。如果您有任何衝突錯誤,請與我們分享錯誤詳情。

+0

如果我創建了一個只包含該設置的web.config文件,該應用程序就停止工作!可能我在寫入文件時出錯。你能給我一個有效的例子嗎?謝謝 ! – Toto

+0

我的web.config是 '<配置> <的requestFiltering> ' 與此文件任何請求在404! – Toto

+1

請嘗試查看和編輯自動生成的web.config以配置requestLimits uisng [kudu或App Service編輯器]的請求限制屬性(https://social.technet.microsoft.com/wiki/contents/articles/36467.understanding -the-Azure的應用服務,editor.aspx)。 –