.net之如何将 httpRuntime maxRequestLength ="8096"集成到 app.config [Webservices]
落叶无声
阅读:38
2025-05-04 20:05:19
评论:0
我有一个等待 xml 到达的网络服务。今天我们注意到,XML 有时似乎太大了。现在我想添加 <httpRuntime maxRequestLength="10096" useFullyQualifiedRedirectUrl="true" executionTimeout="120"/>到我的 app.config。不幸的是,它似乎没有任何效果……这是我的 app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="10096"
useFullyQualifiedRedirectUrl="true"
executionTimeout="120"/>
</system.web>
<system.serviceModel>
<client />
<standardEndpoints />
<services>
<service behaviorConfiguration="metadataSupport" name="iib.wohnpreis.wohnpreisserver">
<host>
<baseAddresses>
<add baseAddress="URLToWebservice" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" transferMode="Buffered" useDefaultWebProxy="false">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport">
<serviceMetadata httpGetEnabled="true" httpGetUrl="wohnpreis/mex" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
有什么错误的建议吗? 谢谢你试图帮助我!
史蒂菲
请您参考如下方法:
找到问题了。服务器告诉客户端 maxStringContentLength 被限制为 8096 - 这不是真的,因为我们定义了它
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" transferMode="Buffered" useDefaultWebProxy="false">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
不幸的是,这只有在我们删除 name="basicHttpBinding" 时才有效,所以它看起来像
<bindings>
<basicHttpBinding>
<binding transferMode="Buffered" useDefaultWebProxy="false">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
不知道名称如何干扰配置 - 但没有名称它工作正常......
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。



