I'm getting the maxreceivedmessagesize error for messages greater than 64K. The problem is that I've already changed everything in both server and client, and it's not fixing the problem.
here's my web.config on the server and then the silverlight client config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureobjectbind" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="GiveWeb.Services.ShopBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="GiveWeb.Services.ShopBehavior"
name="GiveWeb.Services.Shop">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="secureobjectbind"
contract="GiveWeb.Services.IShop">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<clear/>
<add prefix="http://www.ushop2give.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
silverlight client
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IShop" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://web14.ai-host.com/Services/Shop.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IShop"
contract="ShopSVC.IShop" name="BasicHttpBinding_IShop" />
</client>
</system.serviceModel>
</configuration>
so why am I still getting the error?
Ok, here's somemore info for the post...
I found one error. My original declaration for my binding object was as System.ServiceModel.Channels.Binding not System.ServiceModel.BasicHttpBinding. That's why I wasn't seeing the properties for MaxReceivedMessageSize on the object.
I have corrected this and created a function to create my proxy, But I'm still getting an error message when more than 65536 bytes are in the return message.
public static ShopSVC.ShopClient ShopClientProxy()
{
System.ServiceModel.EndpointAddress lxAddress = new System.ServiceModel.EndpointAddress(new Uri(Application.Current.Host.Source, "../Services/Shop.svc"));
System.ServiceModel.BasicHttpBinding lxBinding = new System.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.Transport);
lxBinding.MaxReceivedMessageSize = 2147483647;
lxBinding.MaxBufferSize = 2147483647;
lxBinding.ReceiveTimeout = new TimeSpan(0, 5, 0);
return new GiveSL.ShopSVC.ShopClient(lxBinding, lxAddress);
}
If the service is being hosted in ASP.NET, you'll also want to make sure that the max request length for the web server allows for messages of that size. For example:
OK, here's another try. Some versions of Silverlight 2 weren't reading the ClientConfig properly, so it was worked around by setting MaxReceivedMessageSize on the client binding through code. Maybe Silverlight 3 has a similar issue. Could you try setting MaxReceivedMessageSize through code? See http://forums.silverlight.net/forums/t/11313.aspx.
Everything looks fine to me, so I wonder if this is something simple. Is the server where you're changing the configuration the same one that the Silverlight client is pointing to at
https://web14.ai-host.com/Services/Shop.svc
? Also, you may want to try pasting the exact same binding configuration from the server config to the client's binding configuration.Finally a solution...
There were two underlying problems:
Now that all my code uses the same function for creating the service client proxy, the setting of MaxReceivedMessageSize is respected and all is well.
Wow... just never saw that one coming.
Thanks everyone (especially Jacob) for hanging with me on this one.
Steve