5

I've been searching this problem, and I found similar problems posted by other users, but everything I've tried doesn't work, The problem is that I'm using a WCF service hosted on IIS, and a client that try to upload a serialized image on a string, the size of the image is 9mb aprox, everythin else works fine, I can send data without problem except the image.

I have enabled tracelog and the error message says that the MaxReceivedMessageSize exceed

Here is my config on service:

<system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true" > <listeners> <add name="xml"/> </listeners> </source> <source name="System.ServiceModel.MessageLogging"> <listeners> <add name="xml"/> </listeners> </source> <source name="myUserTraceSource" switchValue="Information, ActivityTracing, All"> <listeners> <add name="xml"/> </listeners> </source> </sources> <trace autoflush="true" /> <sharedListeners> <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="ErrorSvcLog.svclog" /> </sharedListeners> </system.diagnostics> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IServicioSalud" closeTimeout="10:01:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="ServiceBehavior" name="ServicioSalud"> <endpoint address="" binding="basicHttpBinding" contract="IServicioSalud" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="200000" /> </behavior> </serviceBehaviors> </behaviors> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="false" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="false" maxMessagesToLog="3000" maxSizeOfMessageToLog="2000"/> </diagnostics> </system.serviceModel> </configuration> 

And the client config

<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IServicioSalud" closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://xxx.xxx.x.xxx:xxxx/wcfservicesalud/Service.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServicioSalud" contract="IServicioSalud" name="BasicHttpBinding_IServicioSalud" /> </client> </system.serviceModel> 
1
  • You need to set the service endpoint to the binding configuration you defined (BasicHttpBinding_IServicioSalud) via the bindingConfiguration attribute. Commented Apr 19, 2013 at 20:11

3 Answers 3

4

In your config file you have not assigned the binding configuration you created, so the default values for BasicHttpBinding are being used. You need to explicitly assign the binding you defined (BasicHttpBinding_IServicioSalud) to your endpoint, like this:

<endpoint address="" bindingConfiguration="BasicHttpBinding_IServicioSalud" binding="basicHttpBinding" contract="IServicioSalud" /> 

Do this for your service config, as the service needs to be set to accept larger data.

Sign up to request clarification or add additional context in comments.

Comments

0

This is my version. Make sure you have have the bindingConfiguration specified in the service you want. In my case I have to specify the name basicHttpBinding.

<bindings> <basicHttpBinding> <binding name="basicHttpBinding" maxBufferSize="64000000" maxReceivedMessageSize="64000000" maxBufferPoolSize="64000000"> <readerQuotas maxDepth="64000000" maxStringContentLength="64000000" maxArrayLength="64000000" maxBytesPerRead="64000000" /> <security mode="None"/> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="WS.Service1Behavior" name="WS.EasyStockWS"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="WS.IEasyStockWS"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> 

Comments

0

For me, the cause was the fact that in my request I had not set the content type.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.