WCF WebApi 中的 ReaderQuota 设置

发布于 2024-12-27 18:14:05 字数 403 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉薄对峙 2025-01-03 18:14:05

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 using XmlDictionaryReaderQuotas.Max (see http://wcf.codeplex.com/SourceControl/changeset/view/ee192ebdfb80#WCFWebApi%2fsrc%2fMicrosoft.Net.Http.Formatting%2fSystem%2fNet%2fHttp%2fFormatting%2fXmlMediaTypeFormatter.cs)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文