question

sphauck avatar image
0 Votes"
sphauck asked RobCaplan edited

Call local web service .. none of the previous answers work...

So I have a Xamarin.Forms app and I am trying to debug web services running locally on my machine.
I don't have a cert and don't want one .. I should be able to run over HTTP

This doesn't work
77828-image.png


This doesn't work
https://devblogs.microsoft.com/xamarin/cleartext-http-android-network-security/

This doesn't work
77829-image.png

This didn't work either ...
77908-image.png


I am running the latest Xamarin.Forms and when I try to downgrade to target Android 9 like James's article indicates it's not possible with the latest Xamarin.Forms.

I need a solution to this days ago ....

I am willing to pay for the solution at this point ... this has to be a problem many others have had or are having right now.

Anyone ???


dotnet-xamarin
image.png (119.0 KiB)
image.png (35.4 KiB)
image.png (33.6 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Forgot to mention .... localhost is reachable from the emulator
77888-image.png


0 Votes 0 ·
image.png (189.2 KiB)

With this in my Manifest
77889-image.png


And this in my network_security_config file
77922-image.png

And the file properties set correctly ...
77923-image.png


I get this error ...
{Java.IO.IOException: Cleartext HTTP traffic to 10.0.2.2 not permitted



0 Votes 0 ·
image.png (40.5 KiB)
image.png (21.9 KiB)
image.png (21.2 KiB)

I added this and it made no difference ...
77918-image.png


0 Votes 0 ·
image.png (12.2 KiB)

Hi, sphauck. Did you use both the android:usesCleartextTraffic and network config xml? The two ways will be mutually exclusive since android 9. Try to remove the related configuration about android:usesCleartextTraffic, use android:networkSecurityConfig only and test again.

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
       android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>

0 Votes 0 ·

0 Answers