我有一个等待 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>
不知道名称如何干扰配置 - 但没有名称它工作正常......
关于.net - 如何将 httpRuntime maxRequestLength ="8096"集成到 app.config [Webservices],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10882493/