DSN_SLO
DSN_SLO

Reputation: 230

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?

Upvotes: 5

Views: 4143

Answers (2)

Sanchitos
Sanchitos

Reputation: 8591

In my case I was trying to do the same with MVC Core App.

In the Properties/launchSettings.json in the Solutions Name Property:

  "applicationUrl": "http://your_ip:5000",

Upvotes: 1

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.

Upvotes: 10

Related Questions