gpt4 book ai didi

c# - WCF 服务 maxReceivedMessageSize basicHttpBinding 问题

转载 作者:IT王子 更新时间:2023-10-29 04:03:26 24 4
gpt4 key购买 nike

我似乎无法让我的 WCF 服务接受发送到它的大量数据。

我为客户端配置了 maxReceivedMessageSize 并且可以很好地接收大数据,这不是问题。它正在向服务发送数据。

我尝试配置该服务,但没有成功。这是我的 web.config:

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceDiscovery />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Service.IService">
<clear />
<endpoint binding="basicHttpBinding" bindingConfiguration="MessageSizeBasic" contract="Service.IService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MessageSizeBasic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="MessageSizeWeb" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</webHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

最佳答案

从您的绑定(bind)中删除名称将使它适用于所有端点,并且应该会产生所需的结果。这样:

<services>
<service name="Service.IService">
<clear />
<endpoint binding="basicHttpBinding" contract="Service.IService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</webHttpBinding>
</bindings>

另请注意,我从端点节点中删除了 bindingConfiguration 属性。否则你会得到一个异常(exception)。

在这里找到了相同的解决方案:Problem with large requests in WCF

关于c# - WCF 服务 maxReceivedMessageSize basicHttpBinding 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11068612/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com