WCF服务maxReceivedMessageSize basicHttpBinding的问题 [英] WCF service maxReceivedMessageSize basicHttpBinding issue
问题描述
我似乎无法让我的WCF服务接受大量被发送到它的数据。
我配置了maxReceivedMessageSize客户端,并可获得大数据下来就好了,这不是问题。它的数据发送到该服务。
我想配置服务,但还没有任何运气。这里是我的web.config:<?/ p>
<预类=郎咸平的XML prettyprint-覆盖> < XML版本=1.0>
<结构>
<&的System.Web GT;
<编译调试=真/>
< /system.web>
< system.serviceModel>
<&行为GT;
< serviceBehaviors>
<&行为GT;
< serviceMetadata httpGetEnabled =真/>
< serviceDebug includeExceptionDetailInFaults =FALSE/>
< serviceDiscovery />
< /行为>
< / serviceBehaviors>
< /行为>
<服务和GT;
<服务名称=Service.IService>
<清/>
<端点绑定=basicHttpBinding的bindingConfiguration =MessageSizeBasic合同=Service.IService/>
< /服务>
< /服务>
<&绑定GT;
<&basicHttpBinding的GT;
<绑定名称=MessageSizeBasicMAXBUFFERSIZE =2147483647maxReceivedMessageSize =2147483647>
< readerQuotas MAXDEPTH =32maxStringContentLength =2147483647
maxArrayLength =16348maxBytesPerRead =4096maxNameTableCharCount =16384/>
< /&结合GT;
< / basicHttpBinding的>
<&的WebHttpBinding GT;
<绑定名称=MessageSizeWebMAXBUFFERSIZE =2147483647maxReceivedMessageSize =2147483647/>
< /&的WebHttpBinding GT;
< /绑定>
< /system.serviceModel>
< system.webServer>
<模块runAllManagedModulesForAllRequests =真/>
< /system.webServer>
< /结构>
从绑定移除名称将它应用到所有端点,并且应该产生所期望的结果。像这样:
<服务和GT;
<服务名称=Service.IService>
<清/>
<端点绑定=basicHttpBinding的合同=Service.IService/>
< /服务>
< /服务>
<&绑定GT;
<&basicHttpBinding的GT;
<结合MAXBUFFERSIZE =2147483647maxReceivedMessageSize =2147483647>
< readerQuotas MAXDEPTH =32maxStringContentLength =2147483647
maxArrayLength =16348maxBytesPerRead =4096maxNameTableCharCount =16384/>
< /&结合GT;
< / basicHttpBinding的>
<&的WebHttpBinding GT;
<结合MAXBUFFERSIZE =2147483647maxReceivedMessageSize =2147483647/>
< /&的WebHttpBinding GT;
< /绑定>
另外请注意,我删除了 bindingConfiguration
从端点节点属性。否则,你会得到一个异常
这相同的解决办法在这里找到:的的问题与WCF 的大型请求
I can't seem to get my WCF service to accept large amounts of data being sent up to it.
I configured the maxReceivedMessageSize for the client and could receive large data down just fine, that's not the issue. It's sending data up to the service.
I tried to configure the service but haven't had any luck. Here's my 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>
Removing the name from your binding will make it apply to all endpoints, and should produce the desired results. As so:
<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>
Also note that I removed the bindingConfiguration
attribute from the endpoint node. Otherwise you would get an exception.
This same solution was found here : Problem with large requests in WCF
这篇关于WCF服务maxReceivedMessageSize basicHttpBinding的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!