|
Have an issue with send requests from Ipads that work fine when we send under 64K size. When request goes over 64K we receive Error 400 from server. Tried all types of settings on server in web.config section
maxRequestLength="2097151"
requestLengthDiskThreshold="400000"
Registry settings for
MaxRequestBytes and MaxFieldLength.
Still Error 400
Would really appreciate this as users can now have to be careful to sync data often and small to have operational apps.
Below is the MT code section for client send:
webRequest = (HttpWebRequest)WebRequest.Create(requestUri.ToString());
if (this._credentials != null)
{
webRequest.Credentials = this._credentials;
}
// Set the method type
webRequest.Method = "POST";
webRequest.Accept = "application/atom+xml";
webRequest.ContentType = "application/atom+xml";
webRequest.Timeout = 1200000;
switch (request.RequestType)
{
case CacheRequestType.UploadChanges:
return ProcessUploadRequest(webRequest, request);
case CacheRequestType.DownloadChanges:
default:
return ProcessDownloadRequest(webRequest, request);
}
}
private object ProcessUploadRequest(HttpWebRequest webRequest, CacheRequest request)
{
using (Stream memoryStream = new MemoryStream())
{
// Create a SyncWriter to write the contents
this._syncWriter = new ODataAtomWriter(base.BaseUri);
this._syncWriter.StartFeed(true, request.KnowledgeBlob ?? new byte[0]);
foreach (IOfflineEntity entity in request.Changes)
{
// Skip tombstones that dont have a ID element.
if (entity.ServiceMetadata.IsTombstone && string.IsNullOrEmpty(entity.ServiceMetadata.Id))
{
continue;
}
string tempId = null;
// Check to see if this is an insert. i.e ServiceMetadata.Id is null or empty
if (string.IsNullOrEmpty(entity.ServiceMetadata.Id))
{
if (TempIdToEntityMapping == null)
{
TempIdToEntityMapping = new Dictionary<string, IOfflineEntity>();
}
tempId = Guid.NewGuid().ToString();
TempIdToEntityMapping.Add(tempId, entity);
}
this._syncWriter.AddItem(entity, tempId);
}
this._syncWriter.WriteFeed(XmlWriter.Create(memoryStream));
memoryStream.Flush();
// Set the content length
webRequest.ContentLength = memoryStream.Position;
using (Stream requestStream = webRequest.GetRequestStream())
{
CopyStreamContent(memoryStream, requestStream);
// Close the request stream
requestStream.Flush();
requestStream.Close();
}
}
// Fire the Before request handler
this.FirePreRequestHandler(webRequest);
// Get the response
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
The information contained in or attached to this electronic transmission constitutes confidential information and may be privileged and exempt from disclosure under applicable law. If you are not the intended recipient, you are on notice that any unauthorized disclosure, copying, distribution or dissemination of this information is strictly prohibited. |
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
