gpt4 book ai didi

c# - 亚马逊.Runtime.AmazonServiceException : Unable to find credentials

转载 作者:太空狗 更新时间:2023-10-29 19:58:15 27 4
gpt4 key购买 nike

我们使用连接到 AWS SNS 服务的 AWS SDK 工具包在 vs 2010 中设计了 WebService 应用程序。

当我们直接从 VS 2010 Development studio 运行时,它完美地工作,但是当我们将网络服务发布到本地 IIS 或专用网络服务器时,它失败了以下错误消息。

Amazon.Runtime.AmazonServiceException: Unable to find credentials

Exception 1 of 4:
System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path
at System.IO.Directory.GetParent(String path)
at Amazon.Runtime.StoredProfileAWSCredentials.DetermineCredentialsFilePath(String profilesLocation)
at Amazon.Runtime.StoredProfileAWSCredentials..ctor(String profileName, String profilesLocation)
at Amazon.Runtime.EnvironmentAWSCredentials..ctor()
at Amazon.Runtime.FallbackCredentialsFactory.<Reset>b__1()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)

Exception 2 of 4:
System.ArgumentException: Path cannot be the empty string or all whitespace.
Parameter name: path
at System.IO.Directory.GetParent(String path)
at Amazon.Runtime.StoredProfileAWSCredentials.DetermineCredentialsFilePath(String profilesLocation)
at Amazon.Runtime.StoredProfileAWSCredentials..ctor(String profileName, String profilesLocation)
at Amazon.Runtime.FallbackCredentialsFactory.<Reset>b__2()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)

Exception 3 of 4:
System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY were not set with AWS credentials.
at Amazon.Runtime.EnvironmentVariablesAWSCredentials..ctor()
at Amazon.Runtime.FallbackCredentialsFactory.<Reset>b__3()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)

Exception 4 of 4:
Amazon.Runtime.AmazonServiceException: Unable to reach credentials server
at Amazon.Runtime.InstanceProfileAWSCredentials.GetContents(Uri uri)
at Amazon.Runtime.InstanceProfileAWSCredentials.<GetAvailableRoles>d__0.MoveNext()
at Amazon.Runtime.InstanceProfileAWSCredentials.GetFirstRole()
at Amazon.Runtime.FallbackCredentialsFactory.<Reset>b__4()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
at Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient..ctor()
at CellicaAwsSnsService..ctor()
at Service..ctor()

最佳答案

在您可以从 Web 服务应用程序访问此路径的任何路径中创建凭证文件例如C:\awsfile\凭据但记住不要给这个文件任何扩展名文件应包含以下数据。

[default]
aws_access_key_id=[your_access_key]
aws_secret_access_key=[your_secret_key]

在此之后,您需要在 Web.config 文件中的 appsetting 标记中设置路径:

<appSettings>
<add key="AWSProfilesLocation" value="C:\awsfile\credentials" />
<add key="AWSRegion" value="us-east-1" />
</appSettings>

关于c# - 亚马逊.Runtime.AmazonServiceException : Unable to find credentials,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29558015/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com