DELIMITER $$
CREATE PROCEDURE `avg_sal`(out avg_sal decimal)
BEGIN
select avg(sal) into avg_sal from salary;
END
var roleArnToAssume = "arn:aws:iam::xxxxxxxxxxxx:role/xxx-xxx";
var clientArn = new AmazonSecurityTokenServiceClient();
var assumeRoleReq = new AssumeRoleRequest();
assumeRoleReq.DurationSeconds = 3600;
assumeRoleReq.RoleSessionName = "XXXXX";
assumeRoleReq.RoleArn = roleArnToAssume;
assumeRoleReq.ExternalId = "xxxxxXxxXxxxXXXXXXxxxxxx";
var assumeRoleRes = GetAssumeRoleResponseAsync(client: clientArn, request: assumeRoleReq);
string tempAccessKeyId = assumeRoleRes.Result.Credentials.AccessKeyId;
似乎与此有关: https://github.com/aws/aws-sdk-net/issues/1131
我已经更新了dll。 使用的AWSSDK.Core版本:3.3.31.19 AWSSDK.SecurityToken:3.3.4.58和3.3.100
更新1: 我去了Debug / Windows / Exceptions Settings并单击了所有类型的异常。现在我有更多信息。
Exception thrown: 'System.InvalidOperationException' in AWSSDK.Core.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Exception thrown: 'Amazon.Runtime.AmazonClientException' in AWSSDK.Core.dll
Exception thrown: 'System.InvalidOperationException' in AWSSDK.Core.dll
Exception thrown: 'System.InvalidOperationException' in AWSSDK.Core.dll
Exception thrown: 'System.InvalidOperationException' in AWSSDK.Core.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Exception thrown: 'System.InvalidOperationException' in AWSSDK.Core.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
答案 0 :(得分:0)
我最终完全更改了代码:
var roleArnToAssume = "arn:aws:iam::111111111111:role/xxx-xxxx";
var assumeRoleReq = new AssumeRoleRequest();
assumeRoleReq.DurationSeconds = 3600;
assumeRoleReq.RoleSessionName = "XXXX";
assumeRoleReq.RoleArn = roleArnToAssume;
assumeRoleReq.ExternalId = "xxxxxxxxxxxxxxxx";
var endpoint = Amazon.RegionEndpoint.USWest1;
var e = endpoint.GetEndpointForService("S3");
Amazon.Runtime.AWSCredentials credentials =
new Amazon.Runtime.BasicAWSCredentials("XXXXXXXXXXXXXXXXXX", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
var clientArn = new AmazonSecurityTokenServiceClient(credentials);
var assumeRoleRes = GetAssumeRoleResponseAsync(client: clientArn, request: assumeRoleReq);
string tempAccessKeyId = assumeRoleRes.Result.Credentials.AccessKeyId;