微信開發博主也是剛開始學習,如果又不準確的地方大家可以一起討論哈QQ:838414520 ,加時請註明來源。謝謝
微信開發首先需要自己準備一個域名用於訪問
這裏博主我準備是一個免費的花生殼域名:
這裏就隨便貼張圖看看效果:
當申請域名成功後就可以準備搭建微信開發環境啦。
第一步:進入開發者指南
配置必要的信息
開發者指南慘開鏈接:
http://mp.weixin.qq.com/wiki/17/2d4265491f12608cd170a95559800f2d.html
配置服務器配置:
根據開發者指南的提示,判斷服務器地址的有效性。如果獲取signature簽名與原來的簽名一致則成功接入開發者。
URL:申請的服務器域名…可搭建本地IIS環境測試後在花生殼添加映射到制定域名
public static void GetSigntrue(string token)
{
var signature = HttpContext.Current.Request.QueryString["signature"];
var timestamp = HttpContext.Current.Request.QueryString["timestamp"];
var nonce = HttpContext.Current.Request.QueryString["nonce"];
var echostr = HttpContext.Current.Request.QueryString["echostr"];
var arr = new[] { token, timestamp, nonce };
Array.Sort(arr);
var tempstr = string.Join("", arr);
var tempsign = FormsAuthentication.HashPasswordForStoringInConfigFile(tempstr, "sha1").ToLower();
if (tempsign == signature)
{
HttpContext.Current.Response.Write(echostr);
HttpContext.Current.Response.End();
}
}
如果tempsign == signature 返回原來的Echostr
提交成功如下圖;