小编Kid*_*ick的帖子

如何在App Config文件上的C#中为AWS AmazonSQSClient设置RegionEndPoint

我已经在我的应用程序配置中这样声明了RegionEndpoint

<add key="AWSRegion" value="EUWest1" xdt:Transform="Insert"/>
Run Code Online (Sandbox Code Playgroud)

在我的程序中,我尝试将其称为AWSRegion

 private static string RegionEndPoint = ConfigurationManager.AppSettings["AWSRegion"];
Run Code Online (Sandbox Code Playgroud)

所以当我声明我的SQSClient时出现错误,无法从字符串转换为RegionEndPoint

var SQSClient = new AmazonSQSClient(credentials, RegionEndPoint);
Run Code Online (Sandbox Code Playgroud)

我试图在这里理解这个问题,如何为C#.NET SDK设置EndPoint / Region:EC2Client?

但它适用于EC2Client,因此对我来说似乎不起作用。

我也曾尝试使用这样的AWS开发工具包声明regionendpoint

private static RegionEndpoint RegionEndPoint = ConfigurationManager.AppSettings["AWSRegion"];
Run Code Online (Sandbox Code Playgroud)

我还收到一条错误消息,提示无法从字符串类型隐式转换为Amazon.RegionEndpoint

因此,如果有办法在配置文件中添加RegionEndPoint并在SQSClient中使用它,请帮助我。

c# amazon-sqs aws-sdk

2
推荐指数
1
解决办法
548
查看次数

标签 统计

amazon-sqs ×1

aws-sdk ×1

c# ×1