WinHttpException in Xamarin.UITest - xamarin

When I call StartApp in Xamarin.UITest, I get a crash from a WinHttpException. It says it received an unexpected response from the server. The last line in the log is a call to POST http://127.0.0.1:xxxxx/ping. If I post to that endpoint in postman, I get a valid response with the text pong. I don't understand why it's failing. This happens on Android emulator and on a real device. Both are Android 7.

When you run the code in your emulator http://127.0.0.1:xxxxx referes back to the emulator not your local computer where you have the API.
Install Chrome in your emulator.
In your local computer open Chrome -> Press F12 -> Options -> More Tools and Remote Devices.
Here you can see you emulator.
Check Port Forwarding and add a new rule, like this:
Or just use 'ngrok' to access the API (ngrok lets you expose a web
server running on the local machine to the internet).
https://ngrok.com/docs#expose

Related

How to capture a server side web api call in chrome dev tools

I have got a web application with the following topology.
A (Web application) ---calls---> B (Local Web Api) ---calls---> C (Remote Web Api)
I am trying to capture the traffic from B to C in chrome DEV tools - network tab, but nothing is logged. It only showing one server request. I want to see the subsequent calls made by that server request. Is it possible?
B is a web site hosted locally on my dev box in IIS.
You are currently only debugging your client side app, so DevTools will only show the single request to your local web API. In order to debug the middle layer, you need to debug the API.
If you are using Node JS for this, you can use the v8 inspector by running node --inspect and then use the debugging URL to open up DevTools. Alternatively you can fallback to using Node Inspector
If you are using .NET Web API, you can use the debugger in Visual Studio to see the subsequent calls to the remote API, but Fiddler is a very handy tool as well, especially for mocking.

Realm Debug with Proxy in Chrome not possible

I used asyncStorage from React-Native to save my data locally on a device but not wanted to switch to Realm. Everything works fine with realm as expected and the data are fetched right too. Only problem is I cannot debug with Chrome because i am behind a proxy
I have the issue that through systemadminrights my computer automatically always connect´s to a proxy wifi. So i have no other option than getting this (Option 2) to run.
Option 1: Smartphone and Laptop are in the same non-proxy wifi (Works)
Option 2: Smartphone and/or Laptop are in the proxy wifi (Don't work)
Is there an option to add the proxy to my Realm with my user:password etc?
I get following error Message:
I am sorry this is no actual Issue - Found out that I had two different networks on each devices - Laptop / Smartphone. As far as i have both in the same networks it works fine

"an error occurred in the application server (Not found)" message in Android app

I've been handed a Genexus KB to make an SD app for it. But each time i want to try it i get a "an error occurred in the application server (Not found)" each time i've ran it in a real device (connected in the internal network thorugh) or in an Android Emulator (Andy).
I've setted the KB to point to a local DB stored in my computer and i've tried different ways to try it and it keeps with no luck.
What else should I do?
PS: when i run the web version of it, there's no problem.
Altight people, first of all thanks for the help you gave me!
Secondly #fpanizza that link you gave me was very useful, I could use CatLog with android emulator Andy (after installing Andy Rootkit) and I found out that my app wasn't reaching REST services in the server which leads me to #Franklin, who was right to let me know that it had to do with REST services and I've found out later that i didn't had installed HTTP Activation at one of the WCF Services at the .Net Framework 4.5 Advanced Services, which allowed to reach REST services, and now it worked.
You can try setting the server URL with the IP of your server.
Is probable that the local host is trying to access itself, the android device.
Service URL property: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?21146
Update
I would do what fpanizza suggests on the comment.
Another troubleshooting idea that may bring some light into problem would be to try to access the rest services from a web navigator on the emulator. The idea would be to validate that the emulator/device can "see" the server. Testing outside the app will help understand if the problem is in the app or the server or the connection device - server.
Thank you #Juan.
For better understanding here I enclose the image.
Control Panel > All Control Panel Items > Programs and Features > Turn Windows features on or off

Why can't I connect to a site on my local network with WP7 via Wifi?

I am working on a WP7 application that retrieves data from a web service. The web service was written by a co-worker and is hosted on a server connected to the office network. The app works just fine in the emulator. However, when I run the app on the actual phone (HTC Surround) it can't connect to the web service. If I try to open a website hosted on the same server that doesn't work either. However I can connect to other websites just fine.
One thing to note is - I don't have a SIM card in the phone, so the only available data connection is via WiFi, which connects to the office network (the same network that the service is hosted on).
I'm able to hit this website just fine from my laptop (on the wired office network), via an Android phone using WiFi, and via an Android phone using 4G.
What could be going on here? Alternatively - how can I debug this issue?
Thanks
I'd start debugging it by using Connectify.me (or something similar) to re-broadcast the wifi network you're having problems with, start Fiddler up and analyze what happens when the device's browser connects to some external site vs the site hosted on your network.

Fiddler and Windows Phone 7 emulator - redirect to proxy

I am just curious - did anyone got Fiddler to work with Windows Phone 7 emulator (RTW build)? When I try working with Fiddler, I am getting a WebException when working with HttpWebRequest insances - NotFound, to be specific. WireShark works fine.
The problem I see here is that Fiddler acts as a proxy and the WP7 application I am using doesn't go through a proxy to pass the request, while WireShark works differently - it doesn't directly pass traffic through it.
There was a similar question here but in my case I would like to override the proxy settings so that the WP7 application will connect to http:/127.0.0.1:8888 as the proxy address. Since WP7 tools are based on Silverlight, is it possible to direct a HttpWebRequest to a proxy first?
EDIT: On this page (Fiddler documentation) it is stated that XDE (Windows Phone 7 emulator) should automatically pick up system proxy settings, but for some reason it seems like it doesn't.
As a temporary workaround for this, you can set Fiddler as a reverse proxy. The process is described here. I used the second option by creating a rule.
NOTE: You have to set the initial host (in the if statement) to the Fiddler proxy location (since the WP7 emulator can see the proxy address). The second URL is the address you want to redirect to.
It will now capture traffic from Windows Phone 7 emulator, although it will still skip some things (like downloaded images), so use this method for testing purposes only.
Here's the very simple solution that worked for me: Link

Resources