C#C
C#2y ago
Sven ☕

Connecting to localhost API Server IP-address

I build this service:
            builder.Services.AddHttpClient("ArticleAPI", client => // Injecten der HttpClientFactory
            {
                client.BaseAddress = new Uri(File.ReadAllText("ipaddress.json")+"/api/");
            });

Now, if there's http://localhost:5255 in this file, my application works.
If I put in my local IP-Address http://192.168.178.22:5255 it doesn't work.
HOWEVER;
I tried to run the application on another PC. There it's the other way around. Localhost doesn't work but their own local IP address does.

Any ideas?
Was this page helpful?