如何配置 web.config 以允许任何长度的请求 [英] How to configure the web.config to allow requests of any length

查看:57
本文介绍了如何配置 web.config 以允许任何长度的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个站点,我想在其中根据 textarea 元素的值创建文件客户端.

I am building a site in which i would like to create a file client side from the value of a textarea element.

我有执行此操作的代码,但出现此错误

I have the code in place to do this, but i am getting this error

HTTP 错误 404.15 - 未找到请求过滤模块是配置为拒绝查询字符串过长的请求.

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

有没有办法覆盖它,以便我能够处理任何大小的请求?

Is there a way to override this so that I am able to process requests of any size?

如果没有,有没有办法在不使用文件系统/活动 x 对象的情况下生成文件客户端?

If not, is there a way to generate files client side without using the filesystem/active x object?

谢谢

推荐答案

将以下内容添加到您的 web.config:

Add the following to your web.config:

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

见:

http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits

更新以反映评论.

requestLimits 元素,用于 requestFiltering [IIS 设置架构]

您可能还需要在 web.config 中添加以下内容

You may have to add the following in your web.config as well

<system.web>
    <httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
</system.web>

请参阅:httpRuntime 元素 (ASP.NET设置架构)

当然,上面配置设置中的数字(32768 和 65536)只是示例.您不必使用这些确切的值.

Of course the numbers (32768 and 65536) in the config settings above are just examples. You don't have to use those exact values.

这篇关于如何配置 web.config 以允许任何长度的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆