你好,我也遇到同样情况了,请问是怎么解决的?
微信退款接口调用返回远程服务器返回错误: 400 错误的请求?我已带上证书请求了,但是还是出现问题。我使用VS工具调试时,可以正常进行退款,但发布到IIS上就出现远程服务器返回错误: 400 错误的请求,代码如下: private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { if (errors == SslPolicyErrors.None) { return true; } else { return false; } } *********************************************以下为发起退款请求代码内容****************************************************** byte[] bs = Encoding.UTF8.GetBytes(data); string cert = @"D:\eg\Dge5\apiclient_cert.p12"; //绝对路径,且已安装证书 string key = "1111111";//密 ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); X509Certificate cer = new X509Certificate(cert, key); HttpWebRequest webrequest = (HttpWebRequest)HttpWebRequest.Create(url); webrequest.ClientCertificates.Add(cer); webrequest.Method = "POST"; webrequest.ContentType = "application/x-www-form-urlencoded"; webrequest.ContentLength = bs.Length; //提交请求数据 Stream reqStream = webrequest.GetRequestStream(); reqStream.Write(bs, 0, bs.Length); reqStream.Close(); //接收返回的页面 WebResponse wr = webrequest.GetResponse();//到了这一步就返回400错误的请求结果了 ******************************************************************************************************************************** 请问有人知道具体是哪里的问题么?
2021-07-06