0
votes

I'm trying to get my App.Config setup correctly to allow my NetTcp Service to return strings larger than 65536, because Im getting this error below

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

So far this is what I've tried but it doesn't work, I was hoping someone could point out my mistake

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="NetTcpSHWS.Service1" behaviorConfiguration="NetTcpSHWS.Service1Behavior">
        <host>
          <baseAddresses>
            <add baseAddress = "net.tcp://localhost:8732/Design_Time_Addresses/NetTcpSHWS/Service1/" />
          </baseAddresses>
        </host>
        <endpoint name="NetRcpEndPoint" address ="" binding="netTcpBinding" bindingConfiguration="netMyConfig" contract="NetTcpSHWS.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint name="NetTcpMetadataPoint" address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NetTcpSHWS.Service1Behavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
          <dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="netMyConfig"
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647"
                 transferMode="Buffered">
          <readerQuotas maxDepth="32"
                        maxStringContentLength="2147483647"
                        maxArrayLength="2147483647"
                        maxBytesPerRead="2147483647"
                        maxNameTableCharCount="2147483647" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

This is just a test app

1
I updated the config settings of my original post with the recommended changes but I'm still getting the errorDomitius
How do you start your service?athabaska
No I just localhosted it via vs tools, but I realised I never configured my client side and thats why I was still getting the issue, facepalmDomitius

1 Answers

1
votes

Add bindingConfiguration:

<endpoint name="NetRcpEndPoint" bindingConfiguration="myConfiguration" ... >

<netTcpBinding>
    <binding name="myConfiguration" ...
    </binding>
</netTcpBinding>

If you don't, your binding configuration won't be used (the default configuration will be used instead).