views:

33

answers:

2

I am trying to send up an xml file and get back an xml file as a response. The file I am trying to send up is slightly over 20,000 KB. I tried adding a timeout, and setting keepalive to false, but neither one works. I've searched around but I can't find anything that is applicable to me. As of now I've just broken the file down and have been sending it up in files between 3 - 4 thousand kb. if anyone has any ideas I would really appreciate it. Thanx.

HttpWebRequest hrequest = (HttpWebRequest)WebRequest.Create();
hrequest.KeepAlive = false;
hrequest.Timeout = 10000 * 60;
hrequest.Method = "POST";
hrequest.Headers.Add("Authorization", "Basic " + 
    Convert.ToBase64String(Encoding.ASCII.GetBytes("")));
hrequest.ContentType = "application/x-www-form-urlencoded";
Byte[] byteArray = Encoding.UTF8.GetBytes(
    File.ReadAllText("C:\\Payvment\\UploadProductsXML\\" + qStart + ".xml"));
hrequest.ContentLength = byteArray.Length;
Stream reqStream = hrequest.GetRequestStream();
reqStream.Write(byteArray, 0, byteArray.Length);
reqStream.Close();
StreamReader streamRdr = new StreamReader(
    hrequest.GetResponse().GetResponseStream());
string strResponse = streamRdr.ReadToEnd();
StringReader stringRdr = new StringReader(strResponse);
A: 

Have you considered using FTP?

jimplode
I can't use an ftp, I'm using a webservice from a different company
sse
+1  A: 

the web server definitely won't allow a request that large unless you change the message size max. in wcf the property is maxRecievedMessageSize and defaults to 64k. also, some of these properties, max size/timeout are properties on the server, and modifying your request is not going to change its mind.

Alex Lo