Błąd WCF - Przekroczono maksymalny limit rozmiaru wiadomości przychodzących (65536) [duplikat]
To pytanie ma już tutaj odpowiedź:
Przekroczono maksymalny limit rozmiaru wiadomości przychodzących (65536) 2 odpowiedziMoja konfiguracja:
Klient ASP.NET hostowany w IIS ExpressUsługa WCF hostowana w aplikacji konsoliUruchamianie programu Visual Studio.NET 2012 w trybie administratoraPróbuję zwrócić 2 obiekty listy z usługi WCF. Moja konfiguracja DZIAŁA FINE, gdy zwracam tylko 1 obiekt listy. Ale kiedy zwracam 2 obiekty List, pojawia się błąd:
Przekroczono maksymalny limit rozmiaru wiadomości przychodzących (65536). Aby zwiększyć przydział, użyj właściwości MaxReceivedMessageSize na odpowiednim elemencie wiążącym.
Wiem, że to pytanie zostało zadane wiele razy na tej stronie i innych stronach. Próbowałem prawie wszystkiego opublikowanego w Internecie z różnymi kombinacjami PLIKU KONFIGURACYJNEGO, ale nadal nie udało mi się to.
Konfiguracja klienta:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="1572864"/>
</system.web>
<system.serviceModel>
<client>
<endpoint name="basicHttpBinding"
address="http://localhost:9502/HCDataService"
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding"
contract="HC.APP.Common.ServiceContract.IHCServiceContract"
behaviorConfiguration="ServiceBehaviour">
</endpoint>
</client>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Konfiguracja serwera:
<configuration>
<system.serviceModel>
<services>
<service name="HC.APP.Server.Service.HCDataService" behaviorConfiguration="ServiceBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://localhost:9502/HCDataService"/>
</baseAddresses>
</host>
<endpoint name="basicHttpBinding"
address="http://localhost:9502/HCDataService"
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding"
contract="HC.APP.Common.ServiceContract.IHCServiceContract">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00" >
<readerQuotas maxDepth="128" maxStringContentLength="8388608" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>