【问题标题】:maxRequestLength is being exceeded on webservice WCFwebservice WCF 上的 maxRequestLength 已超出
【发布时间】:2019-05-17 19:21:01
【问题描述】:
我的 web 服务有问题,请求超出了我的 web 服务上的最大 int 大小我已经将 webconfig 设置为此,但它不起作用
<httpRuntime targetFramework="4.5.1" executionTimeout="300" maxRequestLength="2147483647" />
有没有办法将它设置为大于 2147483647 ?
是的,我已经在这里查看了这些答案,但没有一个答案是我对这个问题的解决方案
【问题讨论】:
标签:
c#
wcf
web-config
webserver
asmx
【解决方案1】:
尝试添加以下配置。
绑定配置。
<binding name="mybinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
DataConstractSerializer。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mybehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
不要忘记在客户端和服务器端之间应用配置(我们应该在客户端和服务器端端点上添加此配置)。在 service 部分添加 bindingConfiguration 和 behaviorConfiguration。
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="mybehavior">
<endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1" bindingConfiguration="mybinding"/>
如果问题仍然存在,请随时告诉我。
【解决方案2】:
经过长时间的搜索,我们在 webservice web.config 文件中找到了这个解决方案设置
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2200000000"/>
</requestFiltering>
</security>
</system.webServer>