Windows Phone 7 - Upload image byte[] to server using webservice causes "The maximum message size quota for incoming messages (65536) has been exceeded" error
Hi
I am a bit confused about this error because as you can see from my server web.config - All of the maximum quotas are much higher than the error states:
<system.web>
<httpRuntime maxRequestLength="2147483647" executionTimeout="2147483647" />
<compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation>
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="userServicesBehaviour" name="service.Service1">
<endpoint binding="basicHttpBinding" contract="service.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" allowCookies="true" closeTimeout="10:00:00" openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" useDefaultWebProxy="false" messageEncoding="Mtom">
<readerQuotas maxBytesPerRead ="2147483647" maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" />
<security mode="None"></security>
</binding>
<binding name="BasicHttpBinding_IService1" allowCookies="true" closeTimeout="10:00:00" openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" useDefaultWebProxy="false" messageEncoding="Mtom">
<readerQuotas maxBytesPerRead ="2147483647" maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" />
<security mode="None"></security>
</binding>
<binding name="mexHttpBinding" allowCookies="true" closeTimeout="10:00:00" openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" useDefaultWebProxy="false" messageEncoding="Mtom">
<readerQuotas maxBytesPerRead ="2147483647" maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" />
<security mode="None"></security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttp" maxReceivedMessageSize ="5000000">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
I have tried increasing similar parameters in the WP7 code as follows but the error still appears:
service.Service1Client serviceClient = new service.Service1Client();
serviceClient.InnerChannel.OperationTimeout = new System.TimeSpan(0, 5, 0);
serviceClient.Endpoint.Binding.CloseTimeout = new System.TimeSpan(10, 0, 0);
serviceClient.Endpoint.Binding.OpenTimeout = new System.TimeSpan(10, 0, 0);
serviceClient.Endpoint.Binding.ReceiveTimeout = new System.TimeSpan(10, 0, 0);
serviceClient.Endpoint.Binding.SendTimeout = new System.TimeSpan(10, 0, 0);
Any advice would be greatly appreciated.
Thanks,
Jason