WCF service maxReceivedMessageSize basicHttpBinding issue

前端 未结 3 942
轮回少年
轮回少年 2020-12-13 06:32

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 l

相关标签:
3条回答
  • 2020-12-13 06:52

    Is the name of your service class really IService (on the Service namespace)? What you probably had originally was a mismatch in the name of the service class in the name attribute of the <service> element.

    0 讨论(0)
  • 2020-12-13 06:58

    When using HTTPS instead of ON the binding, put it IN the binding with the httpsTransport tag:

        <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>
    
    0 讨论(0)
  • 2020-12-13 07:11

    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

    0 讨论(0)
提交回复
热议问题