微信端服务器配置
来源:互联网 发布:网络世界边锋游戏 编辑:程序博客网 时间:2024/06/03 21:27
一.服务器设置
IIS建立站点并配置好域名,如http://wx.xxx.com。
二.微信平台设置
1.设置IP白名单,将服务器IP加入。
2.开发--基本配置--服务器配置,设置URL为站点的网址,设置Token。此时验证会提示异常的,需要将网站首页增加验证代码。
三.服务器网站验证,将首页文件增加以下代码:
public ActionResult Index()
{
CheckWeChat();
return View();
}
private void CheckWeChat()
{
string token = "xxxxxxxxxxxxxxxxxxx";
string echoStr = Request.QueryString["echoStr"];
//从微信服务器接收传递过来的数据
string signature = Request.QueryString["signature"]; //微信加密签名
string timestamp = Request.QueryString["timestamp"];//时间戳
string nonce = Request.QueryString["nonce"];//随机数
string[] ArrTmp = { token, timestamp, nonce };
Array.Sort(ArrTmp); //字典排序
string tmpStr = string.Join("", ArrTmp);//将三个字符串组成一个字符串
tmpStr = FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr, "SHA1");//进行sha1加密
tmpStr = tmpStr.ToLower();
if (tmpStr == signature)
{
if (!string.IsNullOrEmpty(echoStr))
{
Response.Write(echoStr);
Response.End();
}
}
}
四.返回第二步服务器配置界面,此时进行验证,通过。
- 微信端服务器配置
- 配置服务器
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置
- 服务器配置。
- 服务器配置
- springboot
- 注解
- GPIO_ReadOutputDataBit及GPIO_ReadInputDataBit区别
- ccf认证压缩编码
- iOS LRC校验
- 微信端服务器配置
- Corporative Network UVA
- iOS开发之内存缓存 磁盘缓存 沙盒
- poj1061青蛙的约会(扩展欧几里得)
- bzoj 1293: [SCOI2009]生日礼物 STL
- centos7 mysql数据库安装和配置
- QT qt5使用qdebug()输出中文 乱码
- 检索框的实现
- 最全面的Java多线程用法解析