[英]Cannot call local web api from cordova android app
I am currently developing a cordova 4.3 android app in Visual Studio 2015 RC. 我目前正在Visual Studio 2015 RC中开发cordova 4.3 android应用程序。 It's an AngularJS app and I use $resource to send requests to an ASP.NET Web Api application running on a different port on the same computer.
这是一个AngularJS应用程序,我使用$ resource将请求发送到在同一台计算机上不同端口上运行的ASP.NET Web Api应用程序。 Debugging the app in Ripple works fine if I disable the Cross Domain Proxy but when I try to debug in the Visual Studio Android Emulator or on my Android device I get a not very helpful "Failed to load resource" as soon as try to reach the web api.
如果我禁用跨域代理,则在Ripple中调试应用程序可以很好地工作,但是当我尝试在Visual Studio Android仿真器或Android设备中进行调试时,尝试达到该目标后,会收到一个非常有用的“无法加载资源”信息网络API。 The url looks correct and I suspect the problem has to do with either CORS or my HTTPS certificate or both?
网址看起来正确,我怀疑问题与CORS或我的HTTPS证书或两者有关? What I have tried so far is:
到目前为止,我尝试过的是:
<uses-permission android:name="android.permission.INTERNET" />
and android:debuggable="true"
in the manifest file. <uses-permission android:name="android.permission.INTERNET" />
和android:debuggable="true"
。 <access origin="*" />
<access origin="*" />
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll)
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll)
配置 I am completely new to cordova/hybrid app development and am surely missing some obvious thing? 我对Cordova /混合应用程序开发完全陌生,并且肯定缺少一些明显的东西吗? Any help or suggestion would be very appreciated!!
任何帮助或建议将不胜感激!
After having all sort of problems with Visual Studio 2015 I uninstalled it went back to Visual Studio 2013 Update 4 and now I can connect my android device to a local running web api using sharp proxy I mentioned and linked to above. 在遇到Visual Studio 2015的各种问题后,我将其卸载到Visual Studio 2013 Update 4,现在我可以使用上面提到并链接到的夏普代理将android设备连接到本地运行的Web api。
So to be clear: 因此要明确:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.