更新时间:2021-12-28 04:12:47
由于您的目标是 Android 9.0(API 级别 28),默认情况下禁用明文(非 HTTPS)支持.要解决此问题,您可以:使用 HTTPS,或者添加配置以允许 http 流量.
Since you are targeting Android 9.0(API level 28) cleartext(non-HTTPS) support is disabled by default. To overcome this you can: either use HTTPS, or, add configs to allow http traffic.
首先,在您的 Android 项目中,创建一个文件夹:xml 并添加文件 network_security_config
First, in your Android Project, create a folder: xml and add the file network_security_config
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">almsdev.southeastasia.cloudapp.azure.com</domain>
</domain-config>
</network-security-config>
然后,在您的 Manifest.xml
<application android:label="YourAppName" android:networkSecurityConfig="@xml/network_security_config">
您可以在 Xamarin 博客文章中阅读更多信息>