在我的生产环境中仅将sdk核心更新到版本3.3.10.2后,我开始遇到此错误。我正在负载均衡器中的4个ec2实例上部署.net api。所有Windows Server 2012 R2。
奇怪的部分,实际上是让我疯狂的部分,如果我在VS 2015中调试它,应用程序运行没有问题,如果我将应用程序发布到我的本地IIS,它运行正常。当我在任何生产机器上部署应用程序时,会发生错误。
我正在使用:
<add key="AWSProfileName" value="{profile name}" />
<add key="AWSProfilesLocation" value="{file location}" />
以及包含相应数据的凭据文件。
在有人要求之前,这个应用程序在这个配置中使用AWS s3已经工作了6个月,并且在凭证或类似的事情上没有任何错误。
更糟糕的是,即使我尝试将aws sdk降级回任何其他版本,错误仍然存在。我完全不知道错误来自何处或如何解决它。请帮忙。
这是堆栈跟踪:
[AmazonServiceException: Unable to find credentials
Exception 1 of 4:
System.TypeInitializationException: The type initializer for 'Amazon.Runtime.CredentialManagement.AWSCredentialsFactory' threw an exception. ---> Amazon.Runtime.AmazonClientException: The encrypted store is not available on this platform.
at Amazon.Util.Internal.SettingsManager.EnsureAvailable()
at Amazon.Runtime.CredentialManagement.SAMLEndpointManager..ctor()
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory..cctor()
--- End of inner exception stack trace ---
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.IsCallbackRequired(Nullable`1 profileType)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(String profileName, ICredentialProfileSource profileSource, CredentialProfileOptions options, RegionEndpoint stsRegion, Boolean nonCallbackOnly)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(CredentialProfile profile, ICredentialProfileSource profileSource, Boolean nonCallbackOnly)
at Amazon.Runtime.AppConfigAWSCredentials..ctor()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_0()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 2 of 4:
Amazon.Runtime.AmazonClientException: Unable to find a default profile in CredentialProfileStoreChain.
at Amazon.Runtime.FallbackCredentialsFactory.GetAWSCredentials(ICredentialProfileSource source, String defaultProfileName)
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 3 of 4:
System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials.
at Amazon.Runtime.EnvironmentVariablesAWSCredentials.FetchCredentials()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_2()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 4 of 4:
Amazon.Runtime.AmazonServiceException: Unable to reach credentials server
at Amazon.Runtime.URIBasedRefreshingCredentialHelper.GetContents(Uri uri)
at Amazon.Runtime.InstanceProfileAWSCredentials.<GetAvailableRoles>d__10.MoveNext()
at Amazon.Runtime.InstanceProfileAWSCredentials.GetFirstRole()
at Amazon.Runtime.FallbackCredentialsFactory.ECSEC2CredentialsWrapper()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
]
Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous) +718
Amazon.S3.AmazonS3Client..ctor(RegionEndpoint region) +59
MGX_2.Models.S3Connection.Read() +83
MGX_2.Models.S3Connection.ReadToString(String k) +43
MGX_2.MgxConfig.Update() +118
MGX_2.MgxConfig.Init() +11
MGX_2.WebApiApplication.Application_Start() +302
[HttpException (0x80004005): Unable to find credentials
Exception 1 of 4:
System.TypeInitializationException: The type initializer for 'Amazon.Runtime.CredentialManagement.AWSCredentialsFactory' threw an exception. ---> Amazon.Runtime.AmazonClientException: The encrypted store is not available on this platform.
at Amazon.Util.Internal.SettingsManager.EnsureAvailable()
at Amazon.Runtime.CredentialManagement.SAMLEndpointManager..ctor()
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory..cctor()
--- End of inner exception stack trace ---
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.IsCallbackRequired(Nullable`1 profileType)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(String profileName, ICredentialProfileSource profileSource, CredentialProfileOptions options, RegionEndpoint stsRegion, Boolean nonCallbackOnly)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(CredentialProfile profile, ICredentialProfileSource profileSource, Boolean nonCallbackOnly)
at Amazon.Runtime.AppConfigAWSCredentials..ctor()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_0()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 2 of 4:
Amazon.Runtime.AmazonClientException: Unable to find a default profile in CredentialProfileStoreChain.
at Amazon.Runtime.FallbackCredentialsFactory.GetAWSCredentials(ICredentialProfileSource source, String defaultProfileName)
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 3 of 4:
System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials.
at Amazon.Runtime.EnvironmentVariablesAWSCredentials.FetchCredentials()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_2()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 4 of 4:
Amazon.Runtime.AmazonServiceException: Unable to reach credentials server
at Amazon.Runtime.URIBasedRefreshingCredentialHelper.GetContents(Uri uri)
at Amazon.Runtime.InstanceProfileAWSCredentials.<GetAvailableRoles>d__10.MoveNext()
at Amazon.Runtime.InstanceProfileAWSCredentials.GetFirstRole()
at Amazon.Runtime.FallbackCredentialsFactory.ECSEC2CredentialsWrapper()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343
[HttpException (0x80004005): Unable to find credentials
Exception 1 of 4:
System.TypeInitializationException: The type initializer for 'Amazon.Runtime.CredentialManagement.AWSCredentialsFactory' threw an exception. ---> Amazon.Runtime.AmazonClientException: The encrypted store is not available on this platform.
at Amazon.Util.Internal.SettingsManager.EnsureAvailable()
at Amazon.Runtime.CredentialManagement.SAMLEndpointManager..ctor()
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory..cctor()
--- End of inner exception stack trace ---
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.IsCallbackRequired(Nullable`1 profileType)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(String profileName, ICredentialProfileSource profileSource, CredentialProfileOptions options, RegionEndpoint stsRegion, Boolean nonCallbackOnly)
at Amazon.Runtime.CredentialManagement.AWSCredentialsFactory.GetAWSCredentials(CredentialProfile profile, ICredentialProfileSource profileSource, Boolean nonCallbackOnly)
at Amazon.Runtime.AppConfigAWSCredentials..ctor()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_0()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 2 of 4:
Amazon.Runtime.AmazonClientException: Unable to find a default profile in CredentialProfileStoreChain.
at Amazon.Runtime.FallbackCredentialsFactory.GetAWSCredentials(ICredentialProfileSource source, String defaultProfileName)
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 3 of 4:
System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials.
at Amazon.Runtime.EnvironmentVariablesAWSCredentials.FetchCredentials()
at Amazon.Runtime.FallbackCredentialsFactory.<>c.<Reset>b__8_2()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
Exception 4 of 4:
Amazon.Runtime.AmazonServiceException: Unable to reach credentials server
at Amazon.Runtime.URIBasedRefreshingCredentialHelper.GetContents(Uri uri)
at Amazon.Runtime.InstanceProfileAWSCredentials.<GetAvailableRoles>d__10.MoveNext()
at Amazon.Runtime.InstanceProfileAWSCredentials.GetFirstRole()
at Amazon.Runtime.FallbackCredentialsFactory.ECSEC2CredentialsWrapper()
at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712
答案 0 :(得分:1)
所以这显然是AWSSDK中的一个错误。 3.3.10.3更新后,问题不再存在。感谢您的回复!