我在将文件上传到 digitalocean 时遇到问题。
private static readonly AmazonS3Config s3ClientConfig = new AmazonS3Config
{
ServiceURL = digOceanEndPoint
};
private static async Task DO_UploadFileAsync()
{
//Test DigitalOcean Upload
try
{
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
IAmazonS3 s3Client = new AmazonS3Client(awsAccessKey, awsSecretKey, s3ClientConfig);
var fileTransferUtility = new TransferUtility(s3Client);
var fileTransferUtilityRequest = new TransferUtilityUploadRequest
{
BucketName = "valentindb",
FilePath = "C:\\Temp\\HelpDesk.jpg",
StorageClass = S3StorageClass.StandardInfrequentAccess,
PartSize = 6291456, // 6 MB
Key = "HelpDesk.jpg",
CannedACL = S3CannedACL.PublicRead
};
await fileTransferUtility.UploadAsync(fileTransferUtilityRequest);
}
catch (AmazonS3Exception e) …Run Code Online (Sandbox Code Playgroud)