I would like to upload couple of images and a text file from iphone to WCF using one NSURLConnection
Post request. So, I attached the NSData
for the images into the body of the request. Apparently, when the Length of body exceeds 65535 bytes, the request doesn't work and won't call WCF. It does work for < 65535 bytes. How can I do this, images can easily be 50,000 bytes each...Am I doing something worng? If not, what's the correct way of handling this? To be honest, I am not quite sure if the problem is on the iphone(client side) or WCF side?
Asked
Active
Viewed 548 times
0

software2007
- 51
- 1
- 7
1 Answers
0
The issue is probably on the WCF side in your web.config file. Please see the question WCF - How to Increase Message Size Quota and accepted answer for more information. Basically, you need to increase the WCF buffer sizes and message size quotas, to get something like this for your <httpBinding>
:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBinding"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647">
<readerQuotas
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<!-- Other code here -->
</system.serviceModel>
You may need or want to adjust these numbers to fit your needs.

Community
- 1
- 1

Drew Gaynor
- 8,292
- 5
- 40
- 53
-
Do you have anything for REST? Here is mine.
-
@software2007: So you're still seeing the issue with that binding? What does the HTTP response to your request look like? – Drew Gaynor Jul 06 '12 at 14:30
-
No response, WCF method doesn't even get invoked for requests> 65535 bytes. – software2007 Jul 06 '12 at 14:42
-
@software2007: Ok, so if you run this in the simulator and look at the requests with [Wireshark](http://www.wireshark.org/) or similar, is the app even making the request? If it is, then there has to be some HTTP response, whether it's a 404, 5xx, etc. That information will help us solve the problem. – Drew Gaynor Jul 06 '12 at 14:53