This error may arise if the service and client binding are
different or in case of dynamic binding suppose you are creating a service with
wshttpbinding and on client you are using basicHttpBinding
as it is default. Then this kind of errror may arise. So please check
both the
binding are same or not. I have given one example below
----------------------------Server
----------------------------------------------
<service name="wshttpService_Name" >
<endpoint
contract="IContract_name" binding="wsHttpBinding"
bindingConfiguration="wshttpService_Name" />
</service>
<wsHttpBinding>
<binding
messageEncoding="Mtom" name ="wshttpService_Name"
maxBufferPoolSize="2147483647"
closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00"
maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
----------------------------client----------------------------------------------
<wsHttpBinding>
<binding name="WSHttpBinding_Service_Name"
closeTimeout="00:15:00"
openTimeout="00:15:00"
sendTimeout="00:15:00" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" >
<readerQuotas
maxDepth="2147483647" maxArrayLength="2147483647" />
</binding>
</wsHttpBinding>
<endpoint
address="http://../Service_name.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_Service_Name"
contract="a.IContract_name"
name="WSHttpBinding_Service_Name">
-------------------------------------------------------------------------------------------
Now in this case suppose we are using dynamic binding like the
below example, Silverlight WCF throwing The remote server returned an error
message will show.
private funProxy.functionClient GetMyServiceClient()
{
BasicHttpBinding binding
= new System.ServiceModel.BasicHttpBinding();
binding.OpenTimeout =
new TimeSpan(0, 0, 60);
binding.ReceiveTimeout =
new TimeSpan(0, 0, 60);
binding.SendTimeout =
new TimeSpan(0, 0, 60);
binding.MaxBufferSize =
2147483647;// 2147483647;
binding.MaxReceivedMessageSize = 2147483647;
// binding.TransferMode =
TransferMode.Buffered;
EndpointAddress endpoint
= new EndpointAddress(
new
Uri(Application.Current.Host.Source, "../Service_name.svc"));
funProxy.functionClient
service = new funProxy.functionClient(binding, endpoint);
return
service;
}