解决了,使用PostMan的Code生成功能解决的。用的是RestSharp发起http请求。 httpclient和webrequest之类的工具死活请求不通。 [图片]
StatusCode: 400, ReasonPhrase: 'Bad Request'?调用接口:https://api.mch.weixin.qq.com/v3/certificates 请求信息:{Method: GET, RequestUri: 'https://api.mch.weixin.qq.com/v3/certificates', Version: 1.1, Content: <null>, Headers:{ Authorization: WECHATPAY2-SHA256-RSA2048 mchid="1520812001",nonce_str="ncmy4ymj.t0b",timestamp="1604154531",serial_no="7E035D22E9BDA25D6AB8A952C9B2918DE8E4B28F",signature="BvhzYN/gRnyM2lthJHiQuAzocX0IGTErzt7de9Gl8FXwXvf5RVpBSPNBSTVdT8LVYkvYEP6Cj10vq7oTsiNllVBIlGGedbl47/iyU7nTzQ0iYvololyojcITzLcciRkq/KVuo6yu6ZNVP5t4R2WgX5dr6wg2RQOuIRSTkfBvWS5wSte7ruyvgR+nReAatrn/QHJ0pE0S5BynypleQCgBoQ65GPQ1lpumeDehCYqCEiTT8UuYQ0IbJ5MMMHFnj/m1sye6E4M4/deHuFfmWDDLP4GgldVHF5y6kLoFKRVu5QllrSJahAqc2lJeGweZyIPl9k1TJt34qWte4gAtlINm8g=="}} 返回信息:Id = 5, Status = RanToCompletion, Method = "{null}", Result = "StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:\r\n{\r\n Connection: keep-alive\r\n Keep-Alive: timeout=8\r\n X-Content-Type-Options: nosniff\r\n Request-ID: 08CFE8F5FC0510E703189DC4C24820E72628FCBE05-270924291\r\n Cache-Control: must-revalidate, no-cache\r\n Date: Sat, 31 Oct 2020 14:27:27 GMT\r\n Server: nginx\r\n Content-Length: 71\r\n Content-Language: zh-CN\r\n Content-Type: application/json; charset=utf-8\r\n}" 使用POSTMAN可以通,但程序死活通不了。 我用的代码就是文档中的代码:https://wechatpay-api.gitbook.io/wechatpay-api-v3/qian-ming-zhi-nan-1/qian-ming-sheng-cheng (拉到最下面的.Net代码)。
2020-11-02老哥,怎么解决了,我也是同样的问题。
.Net 调用 V3接口总数返回400怎么搞?我在调用V3境外下单接口时候总数返回400, 我用 微信 官方的postman看到也是回400但是 有body可以 看到具体原因,这个要怎么搞,有没有asp.net mvc 连接V3 demo.
2020-10-31