c# - Upload file Amazon S3 return The stream does not support concurrent IO read or write operations -


i try upload file in amazon s3, return message.

my code:

amazons3config s3config = new amazons3config() {     serviceurl = "s3.amazonaws.com",     communicationprotocol = protocol.http,     regionendpoint = regionendpoint.saeast1 };  using (amazons3client client = new amazons3client(key_s3, password, s3config)) {      string pathins3 = folder + "/" + filename;     putobjectrequest request = new putobjectrequest();      request.withbucketname(bucket_name);     request.withkey(pathins3);      request.withinputstream(memorystreamfile);     request.cannedacl = s3cannedacl.publicreadwrite;      client.putobject(request);  } 

i had use lock in request , client not resolve.

i think problem memorystreamfile, please double check trying read content of memorystreamfile.so way upload files amazons3 c# following:

            amazons3config cfg = new amazons3config();             cfg.regionendpoint = amazon.regionendpoint.eucentral1;// region endpoint             string bucketname = "your bucket";             amazons3client s3client = new amazons3client("your access key", "your secret key", cfg);                         string datastring ="your data ";             memorystream data = new system.io.memorystream(utf8encoding.ascii.getbytes(datastring));             transferutility t = new transferutility(s3client);             t.upload(data, bucketname, "testuploadfromtransferutility.txt"); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -