我有一个简单的webmethod
[WebMethod]
public int myWebMethod(string fileName, Byte[] fileContent)
然而,每当我传递一个大于30mb的字节数组时,我就会得到这样的错误:
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
属性默认为30mb。但是,我已经将其设置为100mb,以及httpRuntime
的maxRequestLength
属性。
我在任何地方都找不到一个没有设置上面已经尝试过的属性的解决方案。我是不是漏掉了什么?
发布于 2013-05-13 06:30:58
您的问题可能在于,applicationhost.config和machine.config文件中的相应设置可能会取代在web.config文件中所做的设置。
如果您有权访问这些属性,请检查相应部分的overrideModeDefault属性是否设置为Allow,如下例所示:
machine.config
<requestFiltering overrideModeDefault="Allow">
<requestLimits maxAllowedContentLength="104857600"/>
</requestFiltering>
AFAIK如果您没有相应配置文件的访问权限,则无法覆盖这些设置。
你可能会找到更多关于系统范围的配置和设置覆盖,和的信息-以及一个非常相似的案例。
发布于 2014-10-01 04:07:10
这是相当古老的。但我今天也有同样的问题。要解决此问题,您需要在web.config中进行必要的设置更改,然后部署到web服务器。重要的是,您需要将应用程序重新部署到web服务器。通过执行此操作,将为您更新IIS设置。根据部署方式的不同,您可能需要先从web服务器删除web应用程序,然后再进行部署。就地更新web.config不会解决这个问题。希望这对其他有同样问题的人有所帮助。
https://stackoverflow.com/questions/9310926
复制相似问题