Álvaro García
Álvaro García

Reputation: 19356

wcf exception: The server did not provide a meaningful reply

I have a service that use the tcp binding and this services allows to the clients interact with the database. I use EF and self tracking entities.

One thing that I want to do is store files in the database, so to not overload the wire, i have two tables with their corresponding entities. One table Documents with the information of the documents (type, size... etc) and other table, Files, that store the binary information, the file.

Well, in local, when I run the client and the service in the same computer, I can store the files that I want. I try with a file of 6MB. But If I run the client in other computer in the same lan, then I have many problems.

For example, if I try to store a small file, 50kB, I don't have problems, but if I try to store the file of 6MB, then I can get different errors.

For example, if I configure in the client a low timeout, for example 1 minute, I get the error:

System.TimeoutException: This request operation sent to net.tcp://192.168.1.5:7997/CMMSHost did not receive a reply within the configured timeout (00:01:00).

If I configure the client to have a timeout of 10 minutes, then I get the following error:

The server did not provide a meaningful reply

The service is hosted in a wpf application, and in the Begin method of the serve that add the document in the database, I send a text with a log to know if the call is received or not. When I get some of the errors, the call in not received, so I think that the problem perhaps is that the self tacking entity for some reason does not arrive to the service.

My app.config for the service is the following:

<endpoint address=""
                  binding="netTcpBinding"
                  bindingConfiguration="tcpBinding"
                  name="NetTcpBindingEndpoint"
                  contract="GTS.CMMS.Service.IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint contract="IMetadataExchange" binding="mexTcpBinding" address="net.tcp://localhost:5000/mex" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="behaviorConfig">
          <!--
          <serviceMetadata httpGetEnabled="true" />-->
          <!--Necesario para poder enviar excepciones desde el servicio al cliente.-->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
          <serviceMetadata/>
        </behavior>
      </serviceBehaviors>
    </behaviors>


    <bindings>
      <netTcpBinding>
        <binding name="tcpBinding" maxBufferSize="67108864"
                      maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
                       transferMode="Buffered" closeTimeout="00:00:10"
                       openTimeout="00:00:10" receiveTimeout="00:20:00"
                       sendTimeout="00:01:00" maxConnections="100">
          <security mode="None"/>
          <readerQuotas maxArrayLength="67108864" maxBytesPerRead="67108864" maxStringContentLength="67108864"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

And the client configuration is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding_IService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00"
          transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
          hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
          maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:20:00"
            enabled="true" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://192.168.1.5:7997/CMMSHost" binding="netTcpBinding"
        bindingConfiguration="NetTcpBinding_IService" contract="IService"
        name="NetTcpBinding_IService" />
    </client>
  </system.serviceModel>
</configuration>

I use a large readquotes, to try to discard that the problem is the size of the file, but the problem persists.

Thanks.

Upvotes: 0

Views: 2472

Answers (1)

Mihai H
Mihai H

Reputation: 3291

I don't think this is an issue related to WCF. I assume its rather related to your IIS. Can you try the following code snippet in your web.config?

<system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="524288000"/>
            </requestFiltering>
        </security>
</system.webServer>

Upvotes: 1

Related Questions