开发者社区> 问答> 正文

短信发送报错

用.net写了个阿里云短信发送测试程序,结果报错:
InvalidDayuStatus.Malformed : The specified dayu status is wrongly formed.
求解。 通信云账号还有50元余额。
源代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Sms.Model.V20160927;
namespace AliyunSms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void btnSendSM_Click(object sender, EventArgs e)
        {
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou",
                "accessId",  //没错的
               "accesskey");            
            IAcsClient client = new DefaultAcsClient(profile);
            SingleSendSmsRequest request = new SingleSendSmsRequest();
            try
            {  
                request.AcceptFormat = Aliyun.Acs.Core.Http.FormatType.JSON;
                request.SignName = "对的";
                request.TemplateCode = "SMS_对的";//
                request.RecNum = "13973350367";// "接收号码,多个号码可以逗号分隔";              
                request.ParamString = "{\"time\":\"12:34\",\"position\":\"suining\",\"text\":\"您好\"}";
                //短信模板:${time}来自${position}的监控信息:${text}。请及时登录查看设备状态或监控视频
                SingleSendSmsResponse httpResponse = client.GetAcsResponse(request);
            }          
            catch (Exception ex)
            {
                Messagebox.Show(ex.Message);
            }
        }
    }
}

展开
收起
ionfox 2017-06-30 07:38:45 6626 0
4 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载