I have a simple .net core web api with one action:
[Route("[action]")]
public class APIController : Controller
{
// GET api/values
[HttpGet]
public string Ping()
{
return DateTime.Now.ToString();
}
}
If I run this via dotnet run I get
Hosting environment: Production
Content root path: C:UsersxxxDocumentsVisual Studio 2015ProjectsSelfHostTestsrcSelfHostTest
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Going to the browser and typing in http://localhost:5000/ping results in a successful return of the current time. However going to a remote machine (same LAN) and trying to access the service via http://odin:5000/ping results in a 404 error. (Odin is the name of the machine running the web api in a console via dotnet run).
Both server (and client!) firewalls are turned off. I can ping "odin" successfully.
Any ideas what simple step I am missing here. I've tried this at home and at work with no success.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…