Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir,

Here is my error, I am getting when I implemented WCF Services with nettcpbinding.
I am just reading an string which is in text file and the size of it is around 8MB, i converted it into bye and then read that, so in string it is returning the data , I saw this in debugging but when it is returning this string data to service client on self hosted environment it shows this error :
The maximum message size quota for incoming messages (65536) has been exceeded.
XML
<configuration>

  <appsettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appsettings>
  <system.web>
    <compilation debug="true" />
	  <httpruntime maxrequestlength="89535600" />
	  
  </system.web>
	<system.webserver>
		<security>
			<requestfiltering>
				<requestlimits maxallowedcontentlength="89535600" />
			</requestfiltering>
		</security>
	</system.webserver>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.servicemodel>
	  <client>
    <endpoint binding="netTcpBinding" bindingconfiguration="TcpSampleBinding">
     contract="WcfServiceLibrary1.IService1" name="SampleClientBinding" />
   </endpoint></client>
   <bindings>
    <nettcpbinding>
     <binding name="TcpSampleBinding" closetimeout="00:20:00" opentimeout="00:20:00">
      receiveTimeout="00:20:00" sendTimeout="00:20:00" transactionFlow="false"
      transferMode="Streamed" maxBufferPoolSize="524288" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <readerquotas maxdepth="64" maxstringcontentlength="10240" maxarraylength="16384">
       maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport" />
     </readerquotas></binding>
    </nettcpbinding>
   </bindings>
   <behaviors>
    <servicebehaviors>
     <behavior name="SampleTestServiceBehaviour">
      <servicedebug includeexceptiondetailinfaults="true" />
      <servicemetadata />
     </behavior>
    </servicebehaviors>
   </behaviors>
	  <services>
    <service behaviorconfiguration="SampleTestServiceBehaviour" name="WcfServiceLibrary1.Service1">
     <endpoint address="" binding="netTcpBinding">
      name="SampleNetTcpBinding" contract="WcfServiceLibrary1.IService1" />
     <endpoint address="mex" binding="mexTcpBinding" bindingconfiguration="">
      name="NetTcpMaxBinding" contract="IMetadataExchange" />
     <host>
      <baseAddresses>
       <add baseaddress="net.tcp://localhost:19957/SampleSvc" />
      </baseAddresses>
     </host>
    </endpoint></endpoint></service>
   </services>
   
  </system.servicemodel>

</configuration>
Posted
Updated 1-Feb-15 23:30pm
v2

Apply binding as given below and use BindingConfiguration for the interface


<binding name="Binding Name" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00">
maxBufferPoolSize="524288" maxBufferSize="2565536" maxReceivedMessageSize="2565536">
<readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2516384">
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientcredentialtype="None">
 
Share this answer
 
Comments
vishvadeepak 2-Feb-15 7:06am    
I already added this like below but still it is not working
<bindings>
<nettcpbinding>
<binding name="TcpSampleBinding" closetimeout="00:20:00" opentimeout="00:20:00"
="" receivetimeout="00:20:00" sendtimeout="00:20:00" transactionflow="false" transfermode="Streamed" maxbufferpoolsize="524288" maxbuffersize="50000000" maxreceivedmessagesize="50000000">
<readerquotas maxdepth="1024" maxstringcontentlength="10240" maxarraylength="16384"
="" maxbytesperread="4096" maxnametablecharcount="16384">
<security mode="None">


If you are running it locally or using an application
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900