0

I am having a client and server(which holds the wcf service) application. The server application was hosted in azure. Via console application I will send some huge data to wcf service and there i will process and save the data into the azure database.

But I am getting the below error in console application

"The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error."

I know that already many question has been raised regarding this error and i tried many different solutions but none of them is working for me.

Client Side Code - Program.cs

        var configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
        var serviceModelSectionGroup = ServiceModelSectionGroup.GetSectionGroup(configuration);
        var clientSection = serviceModelSectionGroup.Client;
        var testEndpoint = clientSection.Endpoints[0];
        //Web service post data

        Binding binding = new BasicHttpBinding(testEndpoint.BindingConfiguration);
        var endpointAddress = new EndpointAddress(testEndpoint.Address.ToString());
        var beh = new EndpointBehaviorElement(testEndpoint.BehaviorConfiguration);

        using (var testService = new LoadServiceClient(binding, endpointAddress))
        {

            var response = testService.ReceivePostLoads(datas);
            testService.Close();
            return response;
        }

Client Side Config:

<system.serviceModel>
<client>
  <endpoint address="http://kafreight.azurewebsites.net/Services/LoadService.svc/LoadService.svc"
    binding="basicHttpBinding" bindingConfiguration="basicHttp_Binding" contract="PostLoads.ILoadService"
    name="Default" behaviorConfiguration="ServiceViewEventBehavior"/>
</client>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttp_Binding" receiveTimeout="00:25:00" sendTimeout="00:25:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" openTimeout="00:25:00" closeTimeout="00:25:00">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="ServiceViewEventBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
</system.serviceModel>

Server Side Config:

 <services>
  <service name="FreightRover.Services.LoadService"
           behaviorConfiguration="longTimeoutBehavior">
    <endpoint name="Default"
              address="LoadService.svc"
              binding="basicHttpBinding"
              bindingConfiguration="longTimeoutBinding"
              contract="FreightRover.Services.ILoadService"
              behaviorConfiguration="ServerEventBehavior" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name ="longTimeoutBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" receiveTimeout="00:25:00" openTimeout="00:25:00" closeTimeout="00:25:00">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="longTimeoutBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="ServerEventBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
 multipleSiteBindingsEnabled="true" />

<services>
  <service name="FreightRover.Services.LoadService"
           behaviorConfiguration="longTimeoutBehavior">
    <endpoint name="Default"
              address="LoadService.svc"
              binding="basicHttpBinding"
              bindingConfiguration="longTimeoutBinding"
              contract="FreightRover.Services.ILoadService"
              behaviorConfiguration="ServerEventBehavior" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name ="longTimeoutBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" receiveTimeout="00:25:00" openTimeout="00:25:00" closeTimeout="00:25:00">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="longTimeoutBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="ServerEventBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
 multipleSiteBindingsEnabled="true" />

Note:

I noticed that on server side the process was running but client throws an error before server returning its response. I did not get any exceptions on server side and all the data's were saved successfully but on client side I am recieving the error "The server did not provide a meaningful reply".

For small amount of data it is working fine and i am getting error only if i try to process the large amount of data.

I been struggling to resolve this issue for past three days. Please, help me to fix this issue.

I tried the solution mentioned in below link

WCF ERROR: The server did not provide a meaningful reply;

The solution something deals with security mode= "Transport"

In my case i dont want to configure any security for my wcf service

New Update:

With the same above config I hosted the server application in local IIS and It was working fine with large data's so i guess problem exists only when we host the application in azure.

Community
  • 1
  • 1
SDK
  • 1,532
  • 1
  • 15
  • 31
  • Possible duplicate of [WCF ERROR: The server did not provide a meaningful reply;](http://stackoverflow.com/questions/16173835/wcf-error-the-server-did-not-provide-a-meaningful-reply) – MethodMan Nov 09 '15 at 14:43
  • @MethodMan I already tried but it was not working for me in my case – SDK Nov 09 '15 at 14:44
  • Can you provide the code for interface and implementation and data samples for small and large amount? – Janne Matikainen Nov 09 '15 at 15:01
  • Try enabling client-side WCF tracing for your console client. http://stackoverflow.com/questions/17591169/how-to-turn-on-wcf-tracing-at-the-client-side This should provide more clues as to what's causing this problem. – Michael Domashchenko Nov 10 '15 at 21:53
  • @MichaelDomashchenko Hi, I tried enabling wcf tracing on client side and there also i receives the same error and didn't get the root cause of the error – SDK Nov 11 '15 at 07:05
  • @SDK how do you host your WCF service? Web role, worker role, I your own VM? – Michael Domashchenko Nov 11 '15 at 11:43
  • My wcfservice was inside my project . So, i will publish my whole application into the azure and i will consume the wcf service. I am not using web role or worker role to host wcf service – SDK Nov 11 '15 at 11:47

0 Answers0