.net - The connection with the server was terminated abnormally (AWS S3 file upload) -
using following code upload gzip file s3:
class program { public static awscredentials credentials; static program() { var chain = new credentialprofilestorechain(); if (!chain.trygetawscredentials("awsconfig", out credentials)) throw new exception("aws credentials not found!!"); } static void main(string[] args) { var filepath = $@"c:\temp\test.gz"; uploadfile("mybucket", filepath, "test"); } private static void uploadfile(string bucketname, string filepath, string prefixkey) { transferutility filetransferutility = new transferutility(new amazons3client(credentials, amazon.regionendpoint.useast1)); transferutilityuploadrequest filetransferutilityrequest = new transferutilityuploadrequest { bucketname = bucketname, filepath = filepath, key = prefixkey, }; filetransferutility.upload(filetransferutilityrequest); console.writeline("upload completed"); } }
i getting error the write operation failed, see inner exception inner exception system.net.http.winhttpexception: connection server terminated abnormally
i thought network problem uploaded application ec2 instance in same region bucket , still getting same error.
the file test.gz file gzip compression , size 274kb.
this problem happens files compressed same way.
what reason of error?
let me know if need file test.
here complete stack trace: https://pastebin.com/rj8qsmsk
Comments
Post a Comment