ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
string postData = "userid=example";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://chatbot.weixin.qq.com/openapi/sign/g8529MURrcxWlejeROtXEvv7lcmjVL");
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = postData.Length;
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(postData);
streamWriter.Flush();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
context.Response.Write(result);
}
您好,我们这边测试并未出现您所说的问题,请您在尝试一下,谢谢。