Reputation: 319
I am developing a mobile application and a REST API
in Visual Studio for Mac
. I want to test the REST API
with my mobile application (which is installed in my smartphone) but I do not know how can I achieve that. I tried to access the REST API
(run on my MacBook) from my smartphone with IP+PORT
e.g. http://190.123.1.123:1234/api/values, but it shows a message saying "The page can't be opened".
Can anyone provide some guidance or maybe correct steps to configure my ASP.NET Core Web API project (REST API) so it allows access from other device within the same network?
Upvotes: 2
Views: 3236
Reputation: 319
In VS Mac, right click project, go to Options > XSP Web Server (Under "Run") > change IP address to your local public IP address e.g 192.123.0.123.
Run the REST API in VS Mac, connect your phone within the same network where you run the host REST API. Open web browser in your phone and enter the IP address with the specific port to access your REST API controller actions (to test the connection).
Upvotes: 5