Uwp cannot connect to vmware server IP

Wan Zhen En 21 Reputation points
2020-10-25T00:31:04.52+00:00

As mentioned in title, my uwp app cannot connect to the ip address of the server running in my vmware, as figure:
34823-image.png

This server was written in nodejs, it can be connected through postman and wpf httpclient, but when I used uwp httpclient to send a post request, the uwp app gave me this response:

*System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Exception: The text associated with this error code could not be found.  
A connection with the server could not be established*  

For your information:

  • I've enabled uwp capabilities: Private Networks (Client & Server), Internet (Client & Server)
  • I've enabled network loopback for my uwp using checknetisolation

My vmware is using nat network setting, as figure:
34824-image.png

It would be great if someone could help me on this, I've searched for two weeks on internet and couldn't find any solution. Your helps would be appreciated!

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2020-10-25T02:02:16.13+00:00

    The Test-NetConnection you posted shows that host and guest are sharing the same ip address, so you'll likely want bridged. If bridged then the guest will connect to the same DHCP server as the host to get its own ip address, or on the guest vEthernet (within the guest itself) you can set a static ip address as needed.

    You'll also likely need to open port 3038 thru firewalls.
    https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/create-an-inbound-port-rule

    ICMP is blocked by default when the firewall profile is private or public, so no real worries there.

    --please don't forget to Accept as answer if the reply is helpful--


2 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-10-25T00:47:41.707+00:00

    Might test on both ends at problem source and on server itself

    Test-NetConnection -Port 3038 -ComputerName "192.168.138.138" -InformationLevel "Detailed"

    testing on the server will confirm something listening or not on that port
    testing on problem source will confirm firewall and or routing issues

    then assuming it can respond to ICMP echo you could also try
    tracert 192.168.138.138

    --please don't forget to Accept as answer if the reply is helpful--


  2. Anonymous
    2020-10-25T02:49:45.23+00:00

    I'm sorry, I know nothing of UWP, my answers were purely from a windows networking perspective. I could only guess maybe they use different ports? This tool may help you to get that answer. https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview

    or a simple netstat -aon on server to show what is listening and on what ports

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.