问题描述
我在我的开发机器和 Android Studio 的模拟器中使用 XAMPP 作为我的测试服务器。每当我尝试使用 Angular HttpClientModule 向测试服务器执行简单的 http 请求时,我都会收到此错误:
错误:javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException
我目前在 XAMPP 服务器中使用自签名证书。我无法弄清楚以下设置缺少什么。
AndroidManifest.xml
<application
...
android:networkSecurityConfig="@xml/network_security_config">
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<certificates src="system" />
<certificates src="user"/>
</trust-anchors>
</debug-overrides>
<base-config>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
test.service.ts
this._http.get('https://10.0.2.2:4433/test.PHP/')
.subscribe((data) => { console.log(data); });
希望我能对此问题有所了解。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)