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.