当前位置:网站首页>微信小程序现金红包返回“IP地址非你在商户平台设置的可用IP地址”错误终极解决方法
微信小程序现金红包返回“IP地址非你在商户平台设置的可用IP地址”错误终极解决方法
2022-07-28 16:20:00 【mojocube】
百度搜了一下,没有根本解决方法(前提是在商户平台已经设置了允许的IP),就是提示IP地址非你在...的错误提示,PS:鄙视一下腾讯,既然你都知道我IP是什么,为什么你返回信息不直接告诉我真实IP地址。

也有相类似的解决方法:

可实际这个IP也不是我的真实IP,因为做了虚拟路由或者是代理等别的手段,不能获取到真实IP地址等。
那我们怎么才能获取真正的符合微信要求的IP呢,看下面的代码:
public string getTrueIP()
{
String direction = "";
string url = "http://checkip.dyndns.org/";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "PROPFIND";
request.ContentType = "application/x-www-form-urlencoded;charset:utf-8";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream stream = response.GetResponseStream();
using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
{
direction = streamReader.ReadToEnd().ToString();
}
}
//Search for the ip in the html
int first = direction.IndexOf("Address: ") + 9;
int last = direction.LastIndexOf("</body>");
direction = direction.Substring(first, last - first);
return direction;
}在服务器执行这个代码,请求第三方工具获取本服务器的真实IP,把这个IP加到商户平台那边,解决。
边栏推荐
- ERROR: transport library not found: dt_ socket
- Add differential pairs and connections in Ad
- Easypoi multi sheet export by template
- Semtech推出物联网地理定位解决方案LoRa Edge,首款芯片LR1110现已上市
- 如何在构建阶段保护镜像安全
- Exercise note 5 (square of ordered array)
- SUSE CEPH add nodes, reduce nodes, delete OSD disks and other operations – storage6
- It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm
- Leetcode647. Palindrome substring
- Modeling Semantics with Gated Graph Neural Networks for KBQA
猜你喜欢

负整数及浮点数的二进制表示

22年多校第三场(F的证明

Ugui learning notes (II) Scrollview related

在AD中添加差分对及连线
![[deep learning]: model evaluation and selection on the seventh day of pytorch introduction to project practice (Part 1): under fitting and over fitting (including source code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: model evaluation and selection on the seventh day of pytorch introduction to project practice (Part 1): under fitting and over fitting (including source code)
![[deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)

浏览器解码过程分析

如何在构建阶段保护镜像安全

Re10: are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr

Re14:读论文 ILLSI Interpretable Low-Resource Legal Decision Making
随机推荐
Alibaba cloud - Wulin headlines - site building expert competition
负整数及浮点数的二进制表示
Unity shader texture animation
Fine-grained Fact Verification with Kernel GA Network
打造自组/安全/可控的LoRa网!Semtech首度回应“工信部新规”影响
Leetcode647. Palindrome substring
Technology sharing | MySQL shell customized deployment MySQL instance
Leetcode 2022.04.10 China Merchants Bank special competition D. store promotion (DP)
In 2020q2, shipments in the global tablet market soared by 26.1%: Huawei ranked third and Lenovo increased the most!
Unity shader procedural texture
Games101-assignment05 ray tracing - rays intersect triangles
Educational codeforces round 126 (rated for Div. 2) f.teleporters (two sets and two points)
《Kubernetes》你需要掌握的 Service 和 Ingress
传英伟达已与软银展开会谈,将出价超过320亿美元收购Arm
Some opinions on bug handling
Question note 4 (the first wrong version, search the insertion position)
Leetcode9. Palindromes
[deep learning]: day 6 of pytorch introduction to project practice: multi-layer perceptron (including code)
Read excel xlsx format file in unity
It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm