- 为什么访问智能对话获取signature接口一进返回超时错误?
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); }
01-08 - 访问接口提示跨域
post接口地址提示趺域:https://chatbot.weixin.qq.com/openapi/sign/{TOKEN} Access to XMLHttpRequest at 'https://chatbot.weixin.qq.com/openapi/sign/xxxxxx' from origin 'http://sdsdsd.cn' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. https://developers.weixin.qq.com/doc/aispeech/confapi/INTERFACEDOCUMENT.html
01-07