启用开发模式须要先成为开发者,并且编辑模式和开发模式只能选择一个,进入微信公众平台-开发模式,以下:服务器
须要填写url和token,当时本人填写这个的时候花了很久,我本觉得填写个服务器的url就能够了(80端口),可是不行,主要是没有仔细的阅读提示信息,因此老是提示微信
从上面能够看出,点击提交后微信会向咱们填写的服务器发送几个参数,而后须要原样返回出来,因此在提交url的时候,先在服务器建立接口测试返回echostr参数内容。代码:微信公众平台
//成为开发者url测试,返回echoStr
public void InterfaceTest()
{
string token = "填写的token";
if (string.IsNullOrEmpty(token))
{
return;
}
string echoString = HttpContext.Current.Request.QueryString["echoStr"];
string signature = HttpContext.Current.Request.QueryString["signature"];
string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
string nonce = HttpContext.Current.Request.QueryString["nonce"];
if (!string.IsNullOrEmpty(echoString))
{
HttpContext.Current.Response.Write(echoString);
HttpContext.Current.Response.End();
}
}