本文介绍了AWS开发工具包CryptProtectData失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在.net上使用aws sdk,在emr集群中创建了Pig活动,并在管道中调用
I am using aws sdk for .net, creating a pig activity in an emr cluster and calling in a pipeline,
try
{
var profileName = ConfigurationManager.AppSettings["AWS_PROFILE_NAME"];
var accessKey = ConfigurationManager.AppSettings["AWS_ACCESS_KEY"];
var secretKey = ConfigurationManager.AppSettings["AWS_SECRET_KEY"];
Amazon.Util.ProfileManager.RegisterProfile(profileName, accessKey, secretKey);
using (_dataPipelineClient = new AmazonDataPipelineClient(accessKey, secretKey, Amazon.RegionEndpoint.USEast1))
{
//proccesing code ...
}
}
catch (Exception e)
{
Logger.Error("ReportScheduler -> Error ocurred.", e);
throw new Exception("ReportScheduler -> Error ocurred.", e);
}
在我的本地服务器上,一切正常运行都没有问题.但是在托管中会抛出此异常:
in my local server it has no problem everything run perfectly. But in the hosting it throw this exception :
AmazonClientException
AmazonClientException
CryptProtectData失败.
CryptProtectData failed.
Amazon.Runtime.Internal.Settings.UserCrypto in Encrypt at line 94:0
System.String Encrypt(System.String)
Amazon.Runtime.Internal.Settings.SettingsCollection+ObjectSettings in WriteToJson at line 94:0
Void WriteToJson(ThirdParty.Json.LitJson.JsonWriter)
Amazon.Runtime.Internal.Settings.SettingsCollection in Persist at line 62:0
Void Persist(System.IO.StreamWriter)
Amazon.Runtime.Internal.Settings.PersistenceManager in saveSettingsType at line 93:0
Void saveSettingsType(System.String, Amazon.Runtime.Internal.Settings.SettingsCollection)
Amazon.Util.ProfileManager in RegisterProfile at line 115:0
Void RegisterProfile(System.String, System.String, System.String)
有人可以给我一些有关问题可能出在哪里的想法.
Can someone give me some idea, about where could be the problem.
谢谢.
推荐答案
我遇到了同样的问题,对我有用的是使用基本的AWS凭证而不是商店的凭证.
I got the same issue and what worked for me was to use basic AWS credentials instead of using store ones.
public static AmazonS3Client GetAwsS3Client(string accessKey, string secretKey)
{
var credentials = new BasicAWSCredentials(accessKey, secretKey);
return new AmazonS3Client(credentials, Amazon.RegionEndpoint.USEast1);
}
这篇关于AWS开发工具包CryptProtectData失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!