Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 类型为';的未处理异常;Amazon.Runtime.AmazonServiceException';发生在AWSSDK.dll中_C#_Amazon Web Services_Amazon S3 - Fatal编程技术网

C# 类型为';的未处理异常;Amazon.Runtime.AmazonServiceException';发生在AWSSDK.dll中

C# 类型为';的未处理异常;Amazon.Runtime.AmazonServiceException';发生在AWSSDK.dll中,c#,amazon-web-services,amazon-s3,C#,Amazon Web Services,Amazon S3,我已尝试向S3存储桶添加对象 static IAmazonS3 client; client = new AmazonS3Client(Amazon.RegionEndpoint.USEast1); PutObjectRequest request = new PutObjectRequest() { BucketName = bucketName, Key = keyName, FilePath = filePath }; PutObjectResponse response2 = clien

我已尝试向S3存储桶添加对象

static IAmazonS3 client;
client = new AmazonS3Client(Amazon.RegionEndpoint.USEast1);
PutObjectRequest request = new PutObjectRequest()
{
BucketName = bucketName,
Key = keyName,
FilePath = filePath
};
PutObjectResponse response2 = client.PutObject(request); 
使用了上面的代码,在运行上面的代码时,我得到了以下错误

An unhandled exception of type 'Amazon.Runtime.AmazonServiceException' occurred in AWSSDK.dll Additional information: Error downloading regions definition file.

我可以使用控制台添加文件,并使用C#程序下载。没有问题。如何解决此错误?

您看到的错误表明无法从AWS加载服务端点说明,但是对于区域和服务的组合(us-east-1,S3),服务端点应该已经内置到AWSSDK.dll中。所以,这令人困惑。您使用的是AWS提供的DLL版本吗?你能将代码放入try/catch并提供堆栈跟踪吗?@JimFlanagan我已经解决了这个问题。谢谢你的投入。问题在于我使用的用户的ACL。