Can't access WEB API with ip:port but can with localhost:port during VS debug mode

后端 未结 5 1822
天涯浪人
天涯浪人 2020-12-08 02:45

I am trying to write an WEB API from .net and trying for my Android Application to query some data from the sql server database.

I have the web api written and it wo

5条回答
  •  一生所求
    2020-12-08 03:05

    Had the same issue debugging in Visual Studio Code, I solved it by adding:

    "env": {
          // ...
          "ASPNETCORE_URLS": "http://*:5000" // change to the port you are using
          // ...
    },
    

    .. to launch.json

    Apparently, by default it binds http protocol to 'localhost:5000', so it works with localhost but not with ip address.

    If you are trying to hit a breakpoint by a request coming from a different computer, don't forget to check your firewall settings (and/or antivirus)

    hope this helps

提交回复
热议问题