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
Sumit Kumawat
NA
454
414.6k
amazon Unable to write data to the transport connection?
Apr 24 2013 3:31 PM
I am developing a software in WPF to upload files on amazon cloud. I am able to successfully upload file using httpweb reuqest object. My problem is that when i pause the upload (i have created a pause button) it should be stop uploading at that time, but when i resume the upload, it display the following exception and the upload get suspended.
Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
My code is as follows:-
Amazon.S3.AmazonS3 s3Client = new Amazon.S3.AmazonS3Client(AccessKey, SecretKey);
Amazon.S3.Model.GetPreSignedUrlRequest request = new Amazon.S3.Model.GetPreSignedUrlRequest();
request.WithBucketName("sample");
request.WithKey("filename");
request.Verb = Amazon.S3.Model.HttpVerb.PUT;
string url = null;
url = s3Client.GetPreSignedURL(request);
HttpWebRequest httpRequest = WebRequest.Create(url) as HttpWebRequest;
httpRequest.Method = "PUT";
httpRequest.Timeout = -1;
httpRequest.ReadWriteTimeout = -1;
httpRequest.KeepAlive = true;
httpRequest.ProtocolVersion = HttpVersion.Version11;
httpRequest.ServicePoint.ConnectionLimit = 10;
httpRequest.AllowWriteStreamBuffering = false;
httpRequest.ContentLength = FileSize;
Stream writeStream = httpRequest.GetRequestStream();
while (true)
{
currentPackageSize = stream.Read(buffer, 0, buffer.Length);
if (currentPackageSize > 0)
{
writeStream.Write(buffer, 0, currentPackageSize);
}
else
break;
}
stream.Flush();
stream.Close();
I need the solution as soon as possible. Thanks in Advance.
Reply
Answers (
0
)
How can i customize window azure VM OS by own vhd file ?
SQL Exception