WCF WebApi 中的 ReaderQuota 设置
在 WCF WebApi(预览版 6)中,许多 WCF 绑定属性已移至配置类中。例如:
var config = new HttpConfiguration {MaxReceivedMessageSize = 250001};
对应的设置是什么?例如,我将如何设置如下配置:
<binding name="largeLimits" maxReceivedMessageSize="250001">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
In WCF WebApi (Preview 6), Many of the WCF binding attributes have been moved into the configuration class. For example:
var config = new HttpConfiguration {MaxReceivedMessageSize = 250001};
What are the corresponding settings for <readerQuotas>
? For example, how would I setup a configuration like:
<binding name="largeLimits" maxReceivedMessageSize="250001">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ReaderQuotas
属性与 SOAP 消息的处理特别相关;根据 MSDN,该属性定义了“端点可以处理的 SOAP 消息的复杂性约束”。但是,Web API 并不与 SOAP 绑定,因此此设置对其没有意义。另一方面,当使用
XmlMediaTypeFormatter
时,此配额可能有意义,但它似乎使用XmlDictionaryReaderQuotas.Max
(请参阅http://wcf.codeplex.com/SourceControl/changeset/view/ee192ebdfb80#WCFWebApi%2fsrc%2fMicrosoft.Net.Http.Formatting%2fSystem%2fNet%2fHttp%2fFormatting%2fXmlMediaTypeFormatter.cs)The
ReaderQuotas
property is specifically related to the processing of SOAP messages; according to MSDN, this property defines "constraints on the complexity of SOAP messages that can be processed by endpoints". However, Web API is not tied to SOAP, so this setting doesn't makes sense for it.On the other hand, this quota could make sense when using the
XmlMediaTypeFormatter
, however it appears to be usingXmlDictionaryReaderQuotas.Max
(see http://wcf.codeplex.com/SourceControl/changeset/view/ee192ebdfb80#WCFWebApi%2fsrc%2fMicrosoft.Net.Http.Formatting%2fSystem%2fNet%2fHttp%2fFormatting%2fXmlMediaTypeFormatter.cs)