Connection refused when trying to acces local webservice using Android

感情迁移 提交于 2019-12-01 14:27:58

Try adding:

if (android.os.Build.VERSION.SDK_INT > 9) {
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
}

Does this help?

check your laptop ip and your device ip.

it should be in same sub net mask

The laptop and mobile(android) device ip must be 192.168.X.X

finally its solved.. the problem is visual studio 2010 so complicated in setting the IIS, then i try to developt my web service on Visual studio 2008 and IIS work fine! the Android can access the web service without connection refused.

Ran into this problem but the solution was rather something some would encounter by familiarity.

Make your the <uses-permission android:name="android.permission.INTERNET"/> is on your Manifest.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!