我有一个简单的web方法
[WebMethod]
public int myWebMethod(string fileName, Byte[] fileContent)
但是,每当我传递一个大于30 MB的字节数组时,我就会得到以下错误:
http错误404.13-未找到请求过滤模块被配置为拒绝超过请求内容长度的请求。
我的web.config如下:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"> </compilation>
<authentication mode="Windows" />
<httpRuntime useFullyQualifiedRedirectUrl="true"
maxRequestLength="102400" requestLengthDiskThreshold="102400"
/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
我已经搜索过了,造成这个问题的最常见的原因是maxAllowedContentLength
属性默认为30 MB。但是,我已经将这个值设置为100 mb,以及maxRequestLength
财产httpRuntime
。
发布于 2018-05-17 08:46:37
问题可能在于web.config文件可能被两个applicationhost.config和Machine.config档案。
如果可以访问这些文件,请检查越位模式防御属性设置为允许,如以下示例所示:
Machine.config
<requestFiltering overrideModeDefault="Allow">
<requestLimits maxAllowedContentLength="104857600"/>
</requestFiltering>
如果无法访问相应的配置文件,AFAIK就无法覆盖这些设置。
发布于 2018-05-17 09:27:42
要解决这个问题,需要在web.config中进行必要的设置更改,然后部署到Web服务器。重要的需要将应用程序重新部署到Web服务器上。这样做,IIS设置将为更新。根据部署的方式,可能需要先从Web服务器中删除Web应用程序,然后再进行部署。适当地更新web.config不会解决问题。希望这能帮助其他人解决同样的问题。
https://stackoverflow.com/questions/-100004511
复制相似问题