绑定设备时老是提示远程服务器400错误
大家好我的绑定设备时老是提示远程服务器400错误,调用接口 'file:///C:/Users/ADMINI~1/AppData/Local/Temp/%25W@GJ$ACOF(TYDYECOKVDYB.pnghttp://api.gizwits.com/app/bind_mac'不知道是什么原因
是自写的程序发的么?url里前边的那段“file:///....”是本地路径,不正确的。
如果是用机智云哪个SDK发的,说说是那个版本的? var bytes = Encoding.UTF8.GetBytes(jsonString);
// await ms.WriteAsync(bytes, 0, bytes.Length);
ms.Write(bytes, 0, bytes.Length);
ms.Seek(0, SeekOrigin.Begin);
WebHeaderCollection nheader = new WebHeaderCollection();
nheader["X-Gizwits-Application-Id"] = "c5cd9be8f7d5462fbaff70956bfe0662";
nheader["X-Gizwits-User-token"] = str_tocken;
nheader["X-Gizwits-Timestamp"] = n_timestamp.ToString();
nheader["X-Gizwits-Signature"] = n_signature;
//nheader.Add("X-Gizwits-Application-Id:c5cd9be8f7d5462fbaff70956bfe0662");
//nheader.Add("X-Gizwits-User-token: " + str_tocken);
//nheader.Add("X-Gizwits-Timestamp: " + n_timestamp.ToString());//
//nheader.Add("X-Gizwits-Signature: " + n_signature);
try
{
resopdata ddd = Post.PostGetJsonjz<resopdata>("http://api.gizwits.com/app/bind_mac", null, ms, null, nheader, timeOut: 100000);
MessageBox.Show(ddd.token);
}
异常扑获,远程服务错误400, long n_timestamp = DateTimeToUnixTimestamp(DateTime.Now);//获取时间戳
string n_signature = GetMd5Hash("af63185f68fb4f2fa6ca0c1781b979b7" + n_timestamp.ToString()).ToLower();//加密
var data = new {
product_key = "7de3063398ad4a889b7b30d97e907798",
mac = "5CCF7F83172D",
remark = "dd",
dev_alias = "dddd"
};
SerializerHelper serializerHelper = new SerializerHelper();
var jsonString = serializerHelper.GetJsonString(data, null);
using (MemoryStream ms = new MemoryStream())
{
var bytes = Encoding.UTF8.GetBytes(jsonString);
// await ms.WriteAsync(bytes, 0, bytes.Length);
ms.Write(bytes, 0, bytes.Length);
ms.Seek(0, SeekOrigin.Begin);
WebHeaderCollection nheader = new WebHeaderCollection();
nheader["X-Gizwits-Application-Id"] = "c5cd9be8f7d5462fbaff70956bfe0662";
nheader["X-Gizwits-User-token"] = str_tocken;
nheader["X-Gizwits-Timestamp"] = n_timestamp.ToString();
nheader["X-Gizwits-Signature"] = n_signature;
try
{
resopdata ddd = Post.PostGetJsonjz<resopdata>("http://api.gizwits.com/app/bind_mac", null, ms, null, nheader, timeOut: 100000);
MessageBox.Show(ddd.token);
}
catch (WebException ex)
{
MessageBox.Show(ex.Response.ToString());
disslogin();
}
}
异常扑获,远程服务错误400,的 token 是从匿名登陆那个接口获取的都不知道问题出在那,其它接口都调用成功,证明格式是没有问题的,请大侠指点一下,
页:
[1]