I know this type of question asked before,but my problem still exist. I have written wcf web service on visual studio and when run it ,it is running on IIS express and give to me this address "http://localhost:63048/Service1.svc" for my service address. when i put this address to my android code
new SetUserFromServerToRv(this).execute("http://localhost:63048/Service1.svc/json/AllUserQuery");
and run it i got this error on debug my code:
java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 63048) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)
I had searched on google and this site and find some solution. according this solution I changed my localhost ip to this: 10.0.3.2 but also i got the same error. according some opinion i change my localhost to Ethernet adapter VirtualBox Host-Only Network ip but i got same error. i run this command on my windows:
C:\Users\sayres>ipconfig
Windows IP Configuration
Ethernet adapter Ethernet:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : x::x:x:x:x%18
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter VirtualBox Host-Only Network #2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : x::x:x:x:x%4
IPv4 Address. . . . . . . . . . . : 192.168.154.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : x::x:x:x:x%15
IPv4 Address. . . . . . . . . . . : 192.168.42.137
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : x.x.x.x
Wireless LAN adapter Local Area Connection* 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Wi-Fi:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
even I put vbox ip on my Asynctask code like this:
new SetUserFromServerToRv(this).execute("http://192.168.56.1/Service1.svc/json/AllUserQuery");
but i got same error:
java.net.ConnectException: failed to connect to /192.168.56.1 (port 80) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused)
By postman i access to my server by this address:
http://localhost:63048/Service1.svc/json/AllUserQuery
and i do not have any problem. In addition I have standalone computer and i connect to internet by USB tethering on mobile phone.
what's your idea??
************Edit***************
As i mention above I have 3 Ethernet adapter VirtualBox Host-Only Network and Ethernet adapter VirtualBox Host-Only Network #2 and Ethernet adapter Ethernet 2. I put these 3 IP on these interfaces into my code and nothing of these IP's works.