Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to host an ASP.NET Core site on a Mac?

Background: I downloaded .NET Core & Visual Studio code to my Mac, created a new MVC template project, and ran it. I can access it from my own computer at localhost:5000. However another computer on my network cannot access it at [my ip address]:5000.

Is there any way at all to host the site on my Mac so other local computers can access?

like image 826
DSN_SLO Avatar asked Mar 10 '23 03:03

DSN_SLO


1 Answers

Yes, you can serve ASP.NET Core web sites from MacOS. I've done so myself.

Your problem is that you're attempting to serve from localhost to another computer. localhost, the special address 127.0.0.1 (on IPv4) is only meant for connections within your computer. You may have seen other software that acts differently, but if you've configured a server to use localhost, it's expected that no other machine will be able to connect to it.

If you want to accept connections from any address, use the special address 0.0.0.0 instead. This tells the software to accept connections on any address/network interface that it can see.

like image 77
Jeremy Avatar answered Mar 19 '23 01:03

Jeremy