Replies: 1 comment
-
After my last windows update, everything seems to be working fine, honestly I don't know what the real issue was, but it tells me that it had to do with a bug in windows, and not the device. This can be closed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For some reason I can no longer connect to my local .NET Core web API when testing on my Android phone (plugged in via USB).
Nothing has changed in my code, however there were 3 Windows 10 updates done, but I could not see anything in the updates that impacted the httpClient call.
I also added a windows inbound firewall rule for that port #, available on domain, private and public. I even allowed all inbounds for each entity, to no avail.
It works when I bring up a browser, also works on the android phone browser which means the phone can see the API, but only when I run the app via the phone httpClient fails to connect. Also tried it via the emulator using 10.0.0.2 with no issues.
I'm following MS recommended standard when using httpClient.
IPv4 local machine: 10.X.X.XX
10.X.X.XXInjected into my service layer
.NET MAU code - Maui program.cs
builder.Services.AddHttpClient<ITestService, TestService>(client =>
{
client.BaseAddress = new Uri("http://10.X.X.XX:xxxx/");
});
Test Service class
private readonly HttpClient _httpClient;
JsonSerializerOptions _serializerOptions;
public TestService(HttpClient httpClient)
{
_httpClient = httpClient;
}
Method Get
HttpResponseMessage response = await _httpClient.GetAsync(_httpClient.BaseAddress + "api/Test/Get/");
API - launch settings file
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://10.X.X.XX:xxxx",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
I'm lost at this point because I feel I have everything in order, but obviously not, seems like a firewall issue but I do have the inbound rule on TCP specific to that port #, not sure what I'm missing here.
Using VS 2022 17.7.6
Samsung S10
Edition Windows 10 Pro
Version 22H2
OS build 19045.3570
Experience Windows Feature Experience Pack 1000.19052.1000.0
All devices are currently updated.
Any help is much appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions