首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法向WCF服务发送大于64KB的soap请求

无法向WCF服务发送大于64KB的soap请求
EN

Stack Overflow用户
提问于 2016-08-30 13:22:12
回答 2查看 472关注 0票数 1

我有一个MVC5Web应用程序,在其中我有一个WCF服务,其中包含以下合同:

代码语言:javascript
复制
[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文件中使用了以下配置:

代码语言:javascript
复制
<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向URL http://localhost:64172/DocumentGenerator.svc发送一个Soap-XML/RPC Request,所有小于65KB的请求都会命中IIS Express Server,但一旦请求变得更大,请求甚至不会命中服务器。

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

任何帮助都是非常感谢的。

EN

回答 2

Stack Overflow用户

发布于 2016-08-30 13:45:58

Stack Overflow用户

发布于 2016-08-30 14:29:26

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

代码语言:javascript
复制
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

你的绑定标签会喜欢这样的

代码语言:javascript
复制
<binding
    maxBufferPoolSize="2147483647"
    maxReceivedMessageSize="2147483647"
    maxBufferSize="2147483647" transferMode="Streamed">
   <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39219279

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档