我无法通过VB.NET中的amazon SNS向移动设备发送消息 [英] I can not send message to mobile via amazon SNS in VB.NET

查看:65
本文介绍了我无法通过VB.NET中的amazon SNS向移动设备发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Amazon SNS将短信发送给用户.i在vb.net中编写了以下代码但发生错误消息属性'AWS.SNS.SMS.SMSType'具有无效的消息属性类型,集合支持的类型前缀是Binary,Number和String。.......我不知道按钮点击事件中code.my代码中的问题在哪里:



我的尝试:



进口亚马逊。 SimpleNotificationService 
Imports Amazon.SimpleNotificationService.Model
Public Class Form1
Dim myclient As New AmazonSimpleNotificationServiceClient
Private Sub Button1_Click(sender As Object,e As EventArgs)Handles Button1.Click
Dim snsreq As New PublishRequest
Dim snsres As New PublishResponse
Dim snsmsgstng As New Dictionary(Of String,MessageAttributeValue)()
snsmsgstng.Add(AWS.SNS.SMS.SenderID,新的MessageAttributeValue()使用{.StringValue =testing ,.DataType =string})
snsmsgstng.Add(AWS.SNS.SMS.SMSType,New MessageAttributeValue()With {.StringValue =Promotional,。DataType =string})
snsreq.MessageAttributes = snsmsgstng
snsreq.PhoneNumber =+ 972543784512'电话号码
snsreq.Message =你得到消息,如果是,那么告诉我??? ..
snsres = myclient.Publish(snsreq)
End Sub
End Class



i还在app.config中添加以下内容

< appSettings> 
< add key =AWSAccessKeyvalue =MYAWSAccessKey/>
< add key =AWSSecretKeyvalue =MYAWSSecretKey/>
< add key =AWSRegionvalue =ap-southeast-1/>
< / appSettings>





请告诉我应该在哪里更改代码...... !!!

解决方案

.DataType是CaSe SeNsItIve ....



尝试String(而不是string)

i want to send the sms to the user via Amazon SNS .i wrote the following code in vb.net but error occured "The message attribute 'AWS.SNS.SMS.SMSType' has an invalid message attribute type, the set of supported type prefixes is Binary, Number, and String."....... i Don't know where the problem in the code.my code on button click event is:

What I have tried:

 Imports Amazon.SimpleNotificationService
 Imports Amazon.SimpleNotificationService.Model
 Public Class Form1
     Dim myclient As New AmazonSimpleNotificationServiceClient
     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim snsreq As New PublishRequest
        Dim snsres As New PublishResponse
        Dim snsmsgstng As New Dictionary(Of String, MessageAttributeValue)()
        snsmsgstng.Add("AWS.SNS.SMS.SenderID", New MessageAttributeValue() With {.StringValue = "testing", .DataType = "string"})
        snsmsgstng.Add("AWS.SNS.SMS.SMSType", New MessageAttributeValue() With {.StringValue = "Promotional", .DataType = "string"})
        snsreq.MessageAttributes = snsmsgstng
        snsreq.PhoneNumber = "+972543784512"     'phone No
        snsreq.Message = "you get message ,if yes then tells me???.."
        snsres = myclient.Publish(snsreq)
     End Sub
End Class


i also add following in app.config

<appSettings  >
 <add  key="AWSAccessKey" value="MYAWSAccessKey" />
 <add key="AWSSecretKey" value="MYAWSSecretKey"/>
 <add key="AWSRegion" value="ap-southeast-1"/>
</appSettings>



please tell me where i should change the code...!!!

解决方案

.DataType is CaSe SeNsItIve ....

Try "String" (instead of "string").


这篇关于我无法通过VB.NET中的amazon SNS向移动设备发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆