I have a phonegapp App running on an Android emulator and I would like to access my ASP.NET MVC 4 server in order to make a log in request.
The problem is that my Emulator can't access my IIS application.
I tried this :
Use 10.0.2.2:port to refer my web site from the android navigator.
Use my local ip address (192.168.0.1:port)
Disabled my Firewall
Change bindings in my configuration file in IISExpress
Despite of that, i've got a "400 bad request error invalid username"...
Can anyone help me ?
I had the same problem. the port number in url isn't recognized by android emulator. so wehn I open visual studio project settings, I changed the IIS settings to have a virtual directory under the local host (for example "localhost/testPorject") instead of "localhost:PortNumer". this worked and the emulator recognized it.
Related
I'm having trouble accessing my server (WAMP) using my real android device. I have an app that downloads the data and parsing it to my listview. In the emulator everything is working fine using "10.0.2.2" I tried 10.0.2.2:80, 10.0.2.2(without port #), (my laptop's ip) 192.168.254.103:80 and 192.168.254.103 (without port #) in my url. My WAMP is online and I even tried turning off firewall. Is there something missing?
UPDATE
I tried browsing via my phone's browser the ip address of my laptop and it says "FORBIDDEN". i tried configuring the httpd.conf of apache based on what I've researched but still can't access the server. please help.
Turn off Firewall -
Give permission to "WAMP folder" by using Folder
sharing options - Basically access to "All" for read, write
I use chrome://inspect page on Chrome PC to use dev tools on Chrome Mobile.
I have my js+webgl games on a "local" website, http :// 127 .0. 0.1/site/, thanks to EasyPHP.
I use to upload the game to a real web server each time I make an edit and want to test it on Android, but I really would prefer the Android device to directly access the local website on my computer.
I know it is possible with the "port forwarding" feature on chrome://inspect, but I do not get it to work.
It uses 8000 as port and localhost:8080 as address.
There is a green dot aside the name of my Android device, so port forwarding is supposed to work.
But when I open http :// 127 .0. 0.1/site/ on the Android device, it says "Oops! Google Chrome could not connect to 127.0.0.1".
What am I doing wrong ?
As long you are in the same network ( fe your home network) both devices can see each other. And if you enabled the ping-command on your operating system you can use to test this.
On the application layer they need the same ports to also talk to each other.
For this talking Easyphp runs the Apache webserver to listen the network for request.
As you remarked; Apache is listening the network on port 8080.
The flexibility of Apache is that you can change the number of that port yourself in the configuartion file. ( see https://collab.its.virginia.edu/wiki/toolbox/example%20httpd.conf%20file.html)
Once you completed this, you will get an error message that you have no access, and you should be happy because this means that both devices can already talk with each other :-)
The error message are thrown up by the build-in security-system of your webserver. This security is most of the time provided on folder level with text files ( see http://www.htaccess-guide.com/ )
Once made these changes your access your localweb folder (or htdocs in ?AMPP) from out the browser of your Android. And is the game on :-)
I build a worklight application. create android app and test this application with local machine , its working fine with emulator.but when i try to test this application with android tablet it through error "The Application failed connecting to the service".
I try to find application-descriptor.xml and fix localhost to 192.168.1.1:8080
my ip local machine,but it not working.In my tablet I can't to go to 192.168.1.1:8080/console/index.html
Can anybody help me regarding this issue. how can i fix this one in my worklight android application and run it on my android tablet
Some things to check:
- Are your tablet and your worklight development machine on the same wireless network? (they need to be!)
- Does your computer have a firewall on it which may need configuring to let the traffic through. As a test you could briefly disable the firewall and see if you then have access (subject to disclaimer of the risk involved in disabling the firewall). A test without disabling the firewall would be to try accessing 192.168.1.1:8080 from another desktop/laptop machine on that same subnet.
Check ip in local machine ipconfig ( field Adaptador de Ethernet )
Set this IP in field host name configuration server.
Rebuild
The other test is to check the direction in other machine, in the same network.
In a command window, run ipconfig and copy the IPv4 address. This is the IP address you need to place as the value for worklightServerRootURL in the file application-descriptor.xml.
The IP address you are usingnow does not look to me like the correct (public) IP address that you need to use. Try my above suggestion.
How about adding "192.168.181.1:8080" in application-descriptor.xml?
I would suggest the following debugging steps:
a) Go to your device browser and browse to http:
//xx.xx.xx.xx:8080/console
-> If this doesn't work, you have an obvious ip address issue. Then you have to figure out why, maybe you have a Symantec thingy that blocks any incoming traffic to your desktop - which they do. You should do an explicit allow.
b) If a) works, then you need to check in your code to make sure your app does try to connect to the server at startup. Or else the app will only try to connect when it calls adapter.
Now, go to your code. open the initOptions.js file. I typically, would set connectOnStartup to true, but also enable the onConnectionFailure so that it runs offline when there is no connection.
var wlInitOptions = {
// # Should application automatically attempt to connect to Worklight Server on application start up
// # The default value is true, we are overriding it to false here.
connectOnStartup : true,
// # The callback function to invoke in case application fails to connect to Worklight Server
onConnectionFailure: function (){wlCommonInit();},
// # Worklight server connection timeout
timeout: 2000,
};
3) Make sure you have the right URL in the application-descriptor.xml
<worklightServerRootURL>http://xx.xx.xx.xx:8080
</worklightServerRootURL>
If you are using the consumer edition (the real purchased WL), your URL would be.
<worklightServerRootURL>http://xx.xx.xx.xx:9080/worklight
</worklightServerRootURL>
(Note no space in between those URL - it's just this website putting a space there when there is a line break)
Redeploy your code to the WL server and create a new APK file. Update your device with the new APK file.
4) Do a test with the console again, you should see the console. Click on the Preview app link, it should work.
5) Now that you have updated your code on the server and the APK file. Open it up again on the device.
Do you still see the error message?
If things still not work.
6) Go to the app setting, since you have enable offline mode, it would allow you to access the App settings (it's the 4th button in Android) Go to Worklight Settings. Select Server Address -> Add the worklight URL to the Server URL. When you go back to the app, this will automatically reload the content from your WL server.
I created a worklight application. I tried running that application on android emulator and i am getting the following error.
[http://localhost:8080/apps/services/api/MyFirstApp/android/query] Host is not responsive.
Try to manually access the URL through the android emulator browser to verify connectivity
So i tried to enter the same url in the emulator browser, i got the following text:
/*-secure-
{"WL-Authentication-Failure": {"wl_remoteDisableRealm":{"reason":"Login Failed}}} */
Can someone help me with this?
I am using Android OS version: 4.2.2, API level: 17
I haven't changed any application settings myself..
I am trying to go to a basic login page with the url "https://jazz.net/jazz/auth/j_security_check"
This is my adapter XML:
<wl:adapter xmlns:wl="worklight.com/integration"; xmlns:http="worklight.com/integration/http"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; name="RQMAdapter">
<displayName>RQMAdapter</displayName>
<description>HTTP type Worklight Adapter for jazz server</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>jazz.net</domain>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="loginToRQM" />
</wl:adapter>
This is my scenario:
I have a requirement where I need to read information about the projects from jazz.net for a user. They are all available on the jazz server within an XML file. I need to process it to a mobile device to make it available on hand held device... So, now I am told that i will have to download some of the files from the server, so i need to have file IO on my app. I learned that we need to write this part using a Cordova plug-in in Worklight.
please let me know what else is needed for the solution... thank you
Make sure to place the actual IP address of your server machine:
Change the value for worklightServerRootURL in the file
application-descriptor.xml (located at: yourProject\apps\yourApp)
Build and deploy
Right-click on the generated Android project >> Run As >> Run application
If you are using using Worklight 5.0.5, make sure to upgrade to 5.0.6, where a fix is available when only API Level 17 is installed.
As for going to that URL, you need to explain where exactly you're trying to go to it from, and how... you need to be more descriptive. It sounds to me like you haven't gone through the Getting Started material. Please do.
I had the same problem.
I have solved it by using the real IP address of the server in the WL app instead of using localhost:
When the emulator is running your app, press the Menu button.
Select to change your server URL
Remove "localhost" and use the IP address.
Accept and try again.
This fixed my problem.
I've started android emulator app and trying to open from embeded browser locally started web-site, but local dns name (from /etc/hosts) is not resolved. Is there any option to enable local resolving?
Refer this URL. The issue is 127.0.0.1 is not the correct IP for accessing local server sites on emulator.
http://localhost:8080/MyTestPage.html // URL to use in computer browser
http://10.0.2.2:8080/MyTestPage.html // URL to use in emulator browser
However, you need to do some configuration changes as suggested in the URL.
Here's how to access a locally hosted website in the Android emulator.
Use IIS/Apache to host the application.
For some obscure reason, Android Virtual Device would not let you connect to the development server created by Visual Studio.
Once you host the application, use your IP address as the web address to connect to the local website. "localhost" just won't work with the AVD. Just go to the command prompt and type ipconfig to get your local ip address. You should be looking for IPv4 Address
Here's Android AVD connecting to Apache (XAMPP)
Here's connecting to IIS
Good Luck everyone and happy testing!!
You should specify your local ip address in browser, something like 192.168.xx.xx