0

I have a C# webserver running on my PC, i can do request to it from a browser and a Console Application (both on the same PC, the same of webserver) and I can access it using Android Emulator too.

Then I have an Android app in C# which should make a simple request (two methods):

using (var ws = new WebClient())
            {
                try
                {
                    Uri uri = new 
                    Uri("http://192.168.137.1:4100/1/2/3/4/5");
                    ws.DownloadStringAsync(uri);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
            using (var cl = new HttpClient())
            {
                HttpResponseMessage res = await cl.GetAsync("http://192.168.137.1:4100/1/2/3/4/5");
                Console.WriteLine(res.ToString());
            }

But i can't access from it. I'm using Android 6.0.1 (API 23).
Some months ago this app was working, so I don't know if it a network problem or a device(smartphone) problem.

Can some one help me?

10
  • Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?
    – Alex
    Nov 13, 2018 at 16:17
  • 1
    If i run it on the emulator works, but i need to run it on a physical smartphone. Nov 13, 2018 at 16:19
  • So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?
    – Alex
    Nov 13, 2018 at 16:23
  • 1
    They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy. Nov 13, 2018 at 16:36
  • 1
    well, as you said it isn't working with an other device. If I understand what you said, i tried to run issexpress /trace:true on cmd that starts a "site" and calling it with localhost: 8080/ returns error 500.19-internal server error Nov 13, 2018 at 18:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.