[英]WCF service maxReceivedMessageSize basicHttpBinding issue
I can't seem to get my WCF service to accept large amounts of data being sent up to it. 我似乎无法让我的WCF服务接受正在发送的大量数据。
I configured the maxReceivedMessageSize for the client and could receive large data down just fine, that's not the issue. 我为客户端配置了maxReceivedMessageSize,可以很好地接收大量数据,这不是问题。 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:
这是我的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. 还要注意,我从端点节点删除了
bindingConfiguration
属性。 Otherwise you would get an exception. 否则,您将获得例外。
This same solution was found here : Problem with large requests in WCF 在这里找到了相同的解决方案: WCF中的大请求问题
When using HTTPS instead of ON the binding, put it IN the binding with the httpsTransport
tag: 当使用HTTPS而不是ON绑定时,请使用
httpsTransport
标记将其放入绑定中:
<binding name="MyServiceBinding">
<security defaultAlgorithmSuite="Basic256Rsa15"
authenticationMode="MutualCertificate" requireDerivedKeys="true"
securityHeaderLayout="Lax" includeTimestamp="true"
messageProtectionOrder="SignBeforeEncrypt"
messageSecurityVersion="WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10"
requireSignatureConfirmation="false">
<localClientSettings detectReplays="true" />
<localServiceSettings detectReplays="true" />
<secureConversationBootstrap keyEntropyMode="CombinedEntropy" />
</security>
<textMessageEncoding messageVersion="Soap11WSAddressing10">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="16384"/>
</textMessageEncoding>
<httpsTransport maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
requireClientCertificate="false" />
</binding>
Is the name of your service class really IService (on the Service namespace)? 您的服务类的名称是否真的是IService (在Service名称空间上)? What you probably had originally was a mismatch in the name of the service class in the
name
attribute of the <service>
element. 您最初可能遇到的是
<service>
元素的name
属性中的服务类名称不匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.