【问题标题】:Not able to send a soap request which is greater than 64KB to the WCF Service无法向 WCF 服务发送大于 64KB 的肥皂请求
【发布时间】:2017-01-06 06:05:31
【问题描述】:

我有一个 MVC 5 Web 应用程序,其中我有一个 WCF 服务,其合同如下:

[ServiceContract(ConfigurationName="IDocumentGenerator")]
public interface IDocumentGenerator
{
    [OperationContract(Action = "GenerateDocument"), XmlSerializerFormat]
    Stream GenerateDocument(string DocId, string Format, string returnAs, string userName, string password, XmlDocument Payload);
}

我在 Web.Config 文件中使用以下配置:

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding
          maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647"
          maxBufferSize="2147483647" transferMode="Streamed">
        </binding>
      </webHttpBinding>
    </bindings>    
    <client>
      <endpoint address="http://localhost:64172/DocumentGenerator.svc" binding="webHttpBinding" contract="IDocumentGenerator" name="WebHttpBinding_IDocumentGenerator" />
    </client>
</system.serviceModel>

接下来,我正在使用 Apache JMeter 将 Soap-XML/RPC Request 发送到 URL http://localhost:64172/DocumentGenerator.svc,所有小于 65KB 的请求都会命中 IIS Express 服务器,但是一旦请求变大,请求甚至不会访问服务器。

我已经尝试了 4-5 个小时的不同选项,但无法解决。

感谢任何帮助。

【问题讨论】:

  • 你得到什么错误?
  • 当我使用 JMeter 时,我不知道如何查看错误。生成的请求行只是错误地变为红色。
  • 从我创建的另一个控制台客户端应用程序中,我收到一个错误:413 - 请求实体太大

标签: c# web-services wcf soap jmeter


【解决方案1】:

JMeter 没有限制。

这是您需要更改的 IIS 默认限制,请参阅:

【讨论】:

  • 但是到目前为止,我使用的是 Visual Studio 的内部 Web 服务器,正如 URL 中的端口号所暗示的那样。
  • 即使在 IIS 上部署后,我也会收到相同的错误 - 请求实体太大。
【解决方案2】:

在您的binding 标签中添加以下内容

<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

你的绑定标签会喜欢这个

<binding
    maxBufferPoolSize="2147483647"
    maxReceivedMessageSize="2147483647"
    maxBufferSize="2147483647" transferMode="Streamed">
   <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-11
    • 2018-04-12
    • 2016-04-11
    • 2011-07-15
    • 1970-01-01
    • 2016-10-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多