【发布时间】:2015-11-13 09:33:15
【问题描述】:
我刚刚使用最后一个 Cordova 工具更新了我的 Visual Studio 2015。 我将 Cordova 更新到 5.4.0 并尝试使用 cordova-android 4.1.1 和 5.0.0
我的错误是当我尝试向我的网络服务 (CORS) 发出发布请求时:
http://ws.MyService.be/PostBug.axd
这是我的 Android 设备上的响应:
Request URL:http://ws.MyService.be/PostBug.axd
Request Method:POST
Status Code:404 Not Found (from cache)
Response Headers
Client-Via:shouldInterceptRequest
Request Headers
Provisional headers are shown
Accept:application/json, text/plain, */*
Cache-Control:no-store, no-cache, must-revalidate
Content-Type:application/json
Origin:file://
User-Agent:Mozilla/5.0 (Linux; Android 5.0; SM-G900F Build/LRX21T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Mobile Safari/537.36
在 config.xml 中:
<access origin="*" />
<allow-navigation href="http://*.infotec.be/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
在 index.html 中:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' http://ws.MyService.be http://www.infotec.be https://push.ionic.io data: gap: maps.googleapis.com maps.gstatic.com https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' 'unsafe-eval' 'unsafe-inline';">
cordova-plugin-whitelist 安装的是 1.0.0 版本
我不知道如何解决这个问题。 我只是试着做一个
cordova platform update android@4.X.X
但即使使用 android 4.1.1 我也会收到此错误 代码和服务没有改变,只有科尔多瓦的版本和所有的改变。并且 Visual Studio 已更新
编辑:
我可以通过邮递员访问该服务。
我刚刚更新到 cordova-plugin-whitelist 1.1.1-dev。
重建我的应用程序后,我现在对所有 http 请求都有 net::ERR_CACHE_MISS 并且都是(失败)状态...没有 HTTP 响应(正文或标头)
【问题讨论】:
-
您可以通过其他方式访问该服务吗?您的服务器是否需要刷新缓存?我想知道这是否与服务器缓存有关,然后是您的 Cordova 更新。
-
@SteveKennedy 我更新了我的答案。我可以通过邮递员访问服务,并且该服务获取发布数据以将其插入数据库。所以没有缓存
-
@Jerome2606 我也有同样的问题。降级到 Crodova 5.3.3 似乎并没有解决这个问题。您是否也降级了 Cordova Android?
标签: android cordova visual-studio-2015 visual-studio-cordova