简体   繁体   中英

Socket exception on AWS Secrets Manager GetSecretValueAsync on .NET Core 2.1

I have been struggling to implement secrets manager on .NET Core. It always returning me with Socket Exception and HTTPRequestException on GetSecretValueAsync method call, while it is working on my colleagues PC.

SocketException: A socket operation was attempted to an unreachable network HttpRequestException: A socket operation was attempted to an unreachable network HttpRequestExceptionSocketException

I have already setup the credentials file needed in AWS default profile located at C:\\Users\\USERNAME.aws\\credentials on Windows and also on each IIS App Pool .aws folder. All credentials stored in UTF-8 format previously ANSI.

Here is sample of the credentials that i got with MFA authentication:AWS credentials file Here is my aws credentials configuration and folder location:Credentials location Mostly my setting with my colleague are the same. Now I'm almost at a dead end. If anybody have experience or AWS Web Services Team willing to help me with the solution for this, please let me know. Thank you. Cheers.

var data = secretManager.GetSecretValueAsync(
    new GetSecretValueRequest
    {
        SecretId = configName
    }
).Result;

UPDATE: I found out the real issue here but still got no solution yet. Because I can't really see where does the secrets manager get the credentials from. And for your information, this method works on .NET Framework in my PC.Issue found

Need more info to help . 1. the path for aws credentials is usually C:\\Users\\USERNAME.aws\\ not C:\\Users\\USERNAME.aws\\
2. in this folder should be a file named config where the region is defined. Put the region where the AWS Secrets Manager is configured. Here an example

[default]
region = us-east-1

If this is not helping describe the configuration please

I have finally found out the real issue here. It is actually because I need to allow IIS_IUSRS group user to access IIS system profile folder. Thank you everyone!

IIS system profile folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM