TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rahul ahuja
NA
80
36.1k
unable to read data from the transport
Sep 4 2014 4:30 PM
Hi
I am getting this exception "unable to read data from the transport connection the connection was closed"
i ref this blog http://briancaos.wordpress.com/2012/07/06/unable-to-read-data-from-the-transport-connection-the-connection-was-closed/
but no use of that. Can some help me in this.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Concat(ServiceURL, "download/LargeFile"));
request.Method = METHOD_TYPE;
request.KeepAlive = false;
request.ProtocolVersion = HttpVersion.Version10;
request.ServicePoint.ConnectionLimit = 1;
FileDTO file = new FileDTO();
file.tokenkey = obj.tokenkey;
file.logonkey = obj.logonkey;
file.fileid = product.fileid;
string path = @"C:\Try\FileDownloads\" + product.LastUpdatedDate; //C:\Try\FileDownloads\201-09-04
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
streamWriter.Write(string.Concat("obj=", new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(file)));
try
{
var response = request.GetResponse();
using (Stream stream = response.GetResponseStream())
{
using (MemoryStream memoryStream = new MemoryStream())
{
// Stream the response to a MemoryStream via the byte array buffer
Byte[] buffer = new Byte[0x1000];
Int32 bytesRead;
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
{
memoryStream.Write(buffer, 0, bytesRead);
}
using (FileStream fs = new FileStream(path + "\\" +product.filename, FileMode.CreateNew, FileAccess.Write))
{
fs.Write(memoryStream.ToArray(), 0, memoryStream.ToArray().Count());
}
}
}
obj.tokenkey = response.Headers.Get("User-Tokenkey");
obj.logonkey = response.Headers.Get("User-Logonkey");
}
catch
{
}
I am able max 103 MB, but my file size is more than 2GB
Reply
Answers (
0
)
asp.net convert panel data and gridview data to word.doc
object reference not set to an instance of anobjectException