web-dev-qa-db-fra.com

Wcf-Le quota maximal de taille de message pour les messages entrants (65536) a été dépassé?

Le quota de taille de message maximum pour les messages entrants (65536) a été dépassé. Pour augmenter le quota, utilisez la propriété MaxReceivedMessageSize sur l'élément de liaison approprié.

<system.serviceModel>

<services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
    <Host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
      </baseAddresses>
    </Host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint address ="" binding="wsHttpBinding" contract="FileService.IService1">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="FileService.Service1Behavior">
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="True"/>
      <!-- To receive exception details in faults for debugging purposes, 
      set the value below to true.  Set to false before deployment 
      to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
  </serviceBehaviors>
  </behaviors>
  </system.serviceModel>
12
Tarantino

Vous devez définir maxReceivedMessageSize = "2147483647" pour augmenter la taille du message. Essayez de changer la configuration en ceci:

<binding maxBufferSize="2147483647" 
         maxBufferPoolSize="2147483647" 
         maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" 
                  maxStringContentLength="2147483647" 
                  maxArrayLength="2147483647" 
                  maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
</binding>

Mais c'est une mauvaise pratique d'augmenter vos valeurs de message à la valeur maximale. Cela peut vous conduire à de graves problèmes avec les fuites DOS.

MISE À JOUR:

<system.serviceModel>
  <bindings>
   <wsHttpBinding>
    <binding name="wsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"  >
      <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
    </binding>
   </wsHttpBinding> 
  </bindings>
  <services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
  <Host>
    <baseAddresses>
      <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
    </baseAddresses>
  </Host>
   <endpoint address ="" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="FileService.IService1">   
   <identity>
    <dns value="localhost"/>
   </identity>
 </endpoint>

 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
 </services>
 <behaviors>
   <serviceBehaviors>
     <behavior name="FileService.Service1Behavior">    
       <serviceMetadata httpGetEnabled="True"/>    
       <serviceDebug includeExceptionDetailInFaults="False" />
     </behavior>
   </serviceBehaviors>
 </behaviors>
</system.serviceModel>
23
Alex