1
我有一個C#lambda函數創建一個簡單的.txt文件是這樣的:如何創建和上傳文件到亞馬遜S3
string file = Path.DirectorySeparatorChar + "tmp" + Path.DirectorySeparatorChar + "file.txt";
File.Create(file);
然後我試圖把它上傳到S3
TransferUtility fileTransferUtility = new TransferUtility(new AmazonS3Client(Amazon.RegionEndpoint.EUWest1));
fileTransferUtility.Upload(file, MyBucketNameInString);
但是,它返回這個錯誤:
File createdOne or more errors occurred. (The process cannot access the file '/tmp/file.txt' because it is being used by another process.): AggregateException
任何解決方案嗎?
是/tmp/file.txt在文本編輯器或其它程序打開文件? – Ehz