Remotely connect to .net core self hosted web api

后端 未结 6 896
既然无缘
既然无缘 2020-12-29 02:11

I have a simple .net core web api with one action:

[Route(\"[action]\")]
public class APIController : Controller
{
    // GET api/values
    [HttpGet]
    pu         


        
6条回答
  •  长情又很酷
    2020-12-29 02:55

    The best way is to adjust the launchSettings.json, which is located inside the Properties folder.

    Change

    "applicationUrl": "https://localhost:5001"
    

    to

    "applicationUrl": "https://0.0.0.0:5001"
    

    This allows the Kestrel Web Server to listen for traffic from all Network Interfaces.

提交回复
热议问题