我们使用AWS SDK工具包在VS 2010中设计了WebService应用程序,它连接到AWS SNS服务。
当我们直接从VS 2010开发工具中运行时,它可以完美地工作, 但是当我们将webservice发布到本地IIS或专用web服务器时,它会失败,并显示以下错误消息。
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()