1

I use AWS S3 to kept file that was uploaded from mobile it's working when upload small file but crash when it's a big file. (file was around 5mb)

this is my code.

TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();
request.BucketName = bucketName;
request.StorageClass = S3StorageClass.Standard;
request.CannedACL = S3CannedACL.PublicRead;
request.FilePath = path;
request.Key = key;
TransferUtilityConfig config = new TransferUtilityConfig();
using (TransferUtility uploader = new TransferUtility(AccessKeyID, SecretAccessKey, Region))
{
    await uploader.UploadAsync(request);
}

and this is an exception

Unhandled Exception:
System.IO.IOException: Error writing request ---> System.Net.Sockets.SocketException: Connection reset by peer
at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, System.Boolean throwOnError, System.IAsyncResult result) [0x000a6] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/WebConnection.cs:1028 
at System.Net.WebConnectionStream.WriteAsyncCB (System.IAsyncResult r) [0x00013] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/System/System.Net/WebConnectionStream.cs:458

I already try to change to assign stream to request instead of path or change timeout but exception is still occured.

What's wrong in my code?

Thank for your help.

LLF
  • 668
  • 3
  • 10
  • 27
  • You're probably exceeding an upload limit at the server. Nothing wrong with your code. – user207421 Jul 07 '17 at 23:20
  • Possible duplicate of [What does "connection reset by peer" mean?](https://stackoverflow.com/questions/1434451/what-does-connection-reset-by-peer-mean) – user207421 Jul 07 '17 at 23:20

0 Answers0