{"id":179,"date":"2011-06-20T15:53:47","date_gmt":"2011-06-20T15:53:47","guid":{"rendered":"8f53295a73878494e9bc8dd6c3c7104f"},"modified":"2011-06-20T15:53:47","modified_gmt":"2011-06-20T15:53:47","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/179","title":{"rendered":"HTTP Error 404.13 - Not Found &#038; IIS7\u6587\u4ef6\u4e0a\u4f20\u7684\u6700\u5927\u5927\u5c0f maxAllowedContentLength\uff0cmaxRequestLength"},"content":{"rendered":"<div id=\"cnblogs_post_body\">\n<p>\u5f53\u4e0a\u4f20\u4e00\u4e2a\u8d85\u8fc730M\u7684\u6587\u4ef6\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u91cd\u5b9a\u5411\u81f3404.13\u9875\u9762\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n<h4><span style=\"color:#ff0000;\">HTTP Error 404.13 - Not Found<\/span><\/h4>\n<h5><span style=\"color:#ff0000;\">The request filtering module is configured to deny a request that exceeds the request content length.<\/span><\/h5>\n<p>\u8fd9\u662f\u7531\u4e8e\u670d\u52a1\u5668\u9650\u5236\u4e86\u6240\u80fd\u4e0a\u4f20\u6587\u4ef6\u7684\u6700\u5927\u503c\u3002\u5176\u503c\u5728configuration\/system.webServer\/security\/requestFiltering\/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file. \u4e2d\u5b9a\u4e49\u3002<\/p>\n<p>\u67e5\u770bC:\\Windows\\System32\\inetsrv\\config\u76ee\u5f55\u4e0b\u7684applicationhost.config\uff0c\u53ef\u4ee5\u5728system.webServer\/security\/requestFiltering\/\u4e2d\u627e\u5230requestLimits\u8bbe\u7f6e\u9879\uff0c\u82e5\u6ca1\u6709\uff0c\u5219\u53ef\u4ee5\u81ea\u884c\u6dfb\u52a0\u5982\u4e0b\uff1a\uff08\u8fd9\u91ccmaxAllowedContentLength\u7684\u5355\u4f4d\u4e3abytes\u3002\uff09<\/p>\n<p>&lt;system.webServer&gt;<br \/>\n&nbsp;&nbsp; &lt;security&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;requestFiltering&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;requestLimits maxAllowedContentLength=\"40000000\" \/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/requestFiltering&gt;<br \/>\n&nbsp;&nbsp; &lt;security&gt;<br \/>\n&lt;system.webServer&gt; <\/p>\n<p>\u4e5f\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u6a21\u5f0f\u4fee\u6539applicationhost.config\u4e3a\uff1a <\/p>\n<p>%windir%\\system32\\inetsrv\\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:40000000 <\/p>\n<p>\u7ecf\u8fc7\u8fd9\u4e2a\u8bbe\u7f6e\u540e\uff0c\u670d\u52a1\u5668\u5bf9\u4e0a\u4f20\u6587\u4ef6\u7684\u5927\u5c0f\u9650\u5236\u5c06\u53d8\u4e3a40000000bytes\u4e86\u3002\u5f53\u7136\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u662f\u670d\u52a1\u5668\u7ea7\u522b\u7684\uff0c\u5982\u679c\u4f60\u60f3\u5728\u67d0\u4e2a\u7ad9\u70b9\u6216\u8005\u67d0\u4e2a\u5e94\u7528\u4e0a\u9650\u5236\u5927\u5c0f\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u8bbe\u7f6e\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u6b21\u8bbe\u7f6e\u7684\u662f\u7ad9\u70b9\u5185\u7684Web.config\u3002 <\/p>\n<p>\u4f46\u662f\u4f60\u8981\u8fdb\u884c\u6b64\u9879\u4fee\u6539,\u8981\u786e\u4fddapplicationhost.config\u4e2d\u5bf9\u8be5\u9879\u4fee\u6539\u7684\u6743\u9650\u5df2\u7ecf\u653e\u5f00\u3002\u53ef\u901a\u8fc7\u5982\u4e0b\u8bbe\u7f6e\u8fdb\u884c\u66f4\u6539\uff1a <\/p>\n<p>modify the overrideModeDefault from \"Deny\" to \"Allow\" like so: <\/p>\n<p>&lt;sectionGroup name=\"system.webServer\"&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; &lt;section name=\"requestFiltering\" overrideModeDefault=\"Allow\" \/&gt;<br \/>\n&lt;\/sectionGroup&gt; <\/p>\n<p>\u786e\u8ba4\u4fee\u6539\u8fc7applicationhost.config\u4e2d\u4e0a\u8ff0\u8bbe\u7f6e\u4ee5\u540e\uff0c\u518d\u8fdb\u884c\u5982\u4e0b\u8bbe\u7f6e\u3002 <\/p>\n<p>\u627e\u5230\u5e94\u7528\u7684Web.config\uff0c\u6309\u4e0a\u8ff0\u8fdb\u884c\u4fee\u6539\uff1a<\/p>\n<p>&lt;system.webServer&gt;<br \/>\n&nbsp;&nbsp; &lt;security&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;requestFiltering&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;requestLimits maxAllowedContentLength=\"40000000\" \/&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;\/requestFiltering&gt;<br \/>\n&nbsp;&nbsp; &lt;security&gt;<br \/>\n&lt;system.webServer&gt; <\/p>\n<p>\u6216\u8005\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u7684\u5f62\u5f0f\uff1a <\/p>\n<p>%windir%\\system32\\inetsrv\\appcmd set config <strong>\"Default Web Site\/&lt;your app&gt;\"<\/strong> -section:requestFiltering -requestLimits.maxAllowedContentLength:40000000 <\/p>\n<p>\u8fd9\u6837\uff0c\u4f60\u5c31\u80fd\u9488\u5bf9\u67d0\u4e2a\u7ad9\u70b9\u7684\u67d0\u4e2a\u5e94\u7528\u8fdb\u884c\u8bbe\u7f6e\u3002 <\/p>\n<p><p>\u4f46\u662f\u5f00\u53d1\u4eba\u5458\u662f\u5728Web.Config\u4e2d\u8fdb\u884c\u4e86\u5982\u4e0b\u8bbe\u7f6e\uff1a <\/p>\n<p>&lt;system.web&gt; <\/p>\n<p>&lt;httpRuntime maxRequestLength=\"40960\" appRequestQueueLimit=\"100\" useFullyQualifiedRedirectUrl=\"true\" executionTimeout=\"120\" \/&gt; <\/p>\n<p>&lt;\/system.web&gt; <\/p>\n<p>\u8fd9\u91cc\u7684maxRequestLength\u636eMSDN\u4ecb\u7ecd\uff1aGets or sets the maximum request size. The maximum request size in kilobytes. The default size is 4096 KB (4 MB). <\/p>\n<p>The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks\uff08\u62d2\u7edd\u670d\u52a1\u653b\u51fb\uff09 that are caused by users who post large files to the server. <\/p>\n<p>The value assigned to this property should be greater or equal to value assigned to the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.configuration.httpruntimesection.requestlengthdiskthreshold(v=VS.90).aspx\"><span style=\"color:#000000;\">RequestLengthDiskThreshold<\/span><\/a> property. <\/p>\n<p>\u4f46\u662f\u5f00\u53d1\u4eba\u5458\u7684\u8fd9\u4e2a\u8bbe\u7f6e\u597d\u50cf\u662f\u4e0d\u8d77\u4f5c\u7528\u7684\u3002\u4ed6\u4eec\u5728\u8fd9\u91cc\uff0c\u9650\u5236\u6700\u5927\u8bf7\u6c42\u957f\u5ea6\u4e3a40MB\uff0c\u8d85\u65f6\u4e3a120s\u3002 <\/p>\n<p>\u4e0b\u6b21\u518d\u770b\u4e00\u4e0b\u5177\u4f53\u8fd9\u4e2a\u8bbe\u7f6e\u662f\u7528\u6765\u505a\u4ec0\u4e48\u7684\u3002 <\/p>\n<p>------------------------- <\/p>\n<p>\u73b0\u5728\u660e\u767d\u4e86\u3002\u8fd9\u4e2a\u662f\u7528\u6765\u8bbe\u7f6e\u5355\u4e2a\u8bf7\u6c42\u7684\u6700\u5927\u957f\u5ea6\u3002\u6bd4\u5982EmailTicket\u4e2d\u82e5\u8bbe\u7f6emaxRequestLength\u4e3a30M\uff0cmaxAllowedContentLength\u4e3a40M, <\/p>\n<p>\u7136\u540e\u5728Reply Email\u65f6\uff0c\u9009\u62e9\u4e86\u4e00\u4e2a35M\u7684\u9644\u4ef6\uff0c\u5728\u70b9\u51fbSave as Draft\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u8bf7\u6c42\u7684\u957f\u5ea6\u5927\u6982\u4f1a\u670935M\uff0c\u8fd9\u4e2a\u5df2\u7ecf\u8d85\u8fc7\u4e86maxRequestLength\u3002\u6b64\u65f6\u8bf7\u6c42\u5c31\u4f1a\u62a5\u9519\u4e86\uff0c\u7ed3\u679c\u662f\u9ec4\u9875\uff1a <\/p>\n<h3>Server Error in '\/emailticket' Application. <\/p>\n<hr width=\"100%\" size=\"1\" \/>\n<\/h3>\n<h4><i>Maximum request length exceeded.<\/i><\/h4>\n<p><b>Description: <\/b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br \/>\n<b>Exception Details: <\/b>System.Web.HttpException: Maximum request length exceeded. <\/p>\n<p>\u6240\u4ee5\uff0c\u6700\u597d\u662fmaxRequestLength\u548cmaxAllowedContentLength\u8bbe\u7f6e\u4e3a\u4e00\u81f4\u7684\u503c\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div id=\"cnblogs_post_body\">\n<p>\u5f53\u4e0a\u4f20\u4e00\u4e2a\u8d85\u8fc730M\u7684\u6587\u4ef6\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u91cd\u5b9a\u5411\u81f3404.13\u9875\u9762\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n<h4><span style=\"color:#ff0000;\">HTTP Error 404.13 - Not Found<\/span><\/h4>\n<h5><span style=\"color:#ff0000;\">The request filtering module is configured to deny a request that exceeds the request content length.<\/span><\/h5>\n<p>\u8fd9\u662f\u7531\u4e8e\u670d\u52a1\u5668\u9650\u5236\u4e86\u6240\u80fd\u4e0a\u4f20\u6587\u4ef6\u7684\u6700\u5927\u503c\u3002\u5176\u503c\u5728configuration\/system.webServer\/security\/requestFiltering\/requestLimits@maxAllowedContentLength setting in the...<\/p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p>\n<p><\/div>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/179\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284],"tags":[41],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-webserver","tag-IIS"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}