【发布时间】:2017-03-01 01:32:54
【问题描述】:
我已在示例应用程序中使用 AWS - Amazon Simple Notification Service NuGet 包成功发送短信。 (在这个包中,它会自动安装 AWSSDK-Core 运行时) 但是,当我尝试在当前项目中合并代码时,我们已经将 AWS 开发工具包用于其他亚马逊服务,但我没有获得发送短信所需的属性之一。
对于发送短信,我们需要创建发布请求对象并将该对象传递给 AmazonSimpleNotificationServiceClient。
请看下面的代码
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient("Access Key", "Secret Access Key", Region);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = message;
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "Phone number to which need to send text message";
然后,我们需要将此对象传递给 SNS
PublishResponse result = smsClient.Publish(publishRequest);
但我没有在我当前的项目中获得“PhoneNumber”属性,该属性指的是最新更新的 AWS 开发工具包(在我的项目中安装了 NuGEt 包 - 适用于 .NET 的最新版本的 AWS 开发工具包)。
如果我尝试安装已成功运行代码的早期 NuGEt 包,我会遇到冲突,因为我在两个 dll 中都获得了“AmazonSimpleNotificationServiceClient”类,即。核心和 AWSSDK。
请提出建议。
【问题讨论】:
标签: amazon-web-services amazon-sns