0

我有一个 Xamarin.Forms 移动应用程序,这个包含一个 WebView。这个 WebView URL 应该是我的本地开发机器,因为我在那里运行了一个 Web 应用程序。

因此,在运行 Android 模拟器时,我尝试使用环回地址https://10.0.2.2:44390 ...但 WebView 仍然是白色的!

我已阅读以下文档,但没有帮助:

https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/connect-to-local-web-services

https://medium.com/@noumaan/ssl-app-dev-a2923d5113c6

https://developer.android.com/studio/run/emulator-networking

该文档似乎专注于使用 HttpClient 访问 WebAPI,但我不确定这种情况对于 WebView 是否正确。

注意到从“Chrome android”中,我收到以下消息:“HTTP 错误 400。请求主机名无效”。我得到以下对话框:

在此处输入图像描述

例如,我的 Blazor 应用程序(使用自签名证书)是否应该使用“10.0.2.2”而不是“localhost”?

如果有人有任何想法,非常欢迎:-)

4

1 回答 1

0

在您的 applicationhost.config 中,将 bindingInformation 中的“localhost”更改为“127.0.0.1”。这为我解决了它。在我找到解决方案的地方查看这个答案。

于 2020-10-14T14:52:38.153 回答