c# - WCF Service: MaxReceivedMessageSize (async) -
i ran exception because message size and/or array-length of data i'm transmitting wcf server client exceeds maximum size. topic occurs quite often, solutions changing maxreceivedmessagesize of service binding.
var binding = new wshttpbinding { maxreceivedmessagesize = int.maxvalue }; binding.readerquotas.maxarraylength = int.maxvalue; host.addserviceendpoint(typeof(ieditor), binding, uri);
but i’m interested how can resolved in different way. consider following method. might result in large byte array. tried converting image base64string.
[servicecontract] public interface ieditor { [operationcontract] byte[] getimage(); }
is there common pattern use beginread/endread streaming byte array in smaller chunks client? how in code?
according microsoft (see this link) contract has adjusted , end-point configuration well.
<system.servicemodel> … <bindings> <basichttpbinding> <binding name="examplebinding" transfermode="streaming"/> </basichttpbinding> </bindings> … <system.servicemodel> [servicecontract(namespace="http://microsoft.servicemodel.samples")] public interface istreamedservice { [operationcontract] stream echo(stream data); [operationcontract] stream requestinfo(string query); [operationcontract(oneway=true)] void provideinfo(stream data); }
Comments
Post a Comment