Home > Back-end >  How to access WEB API on .NET Core from the outside network?
How to access WEB API on .NET Core from the outside network?

Time:02-13

I want to access my API from the outside ?

On the local machine I access my API like this:

https://localhost:44377/api/stations 

So my IP address for example is: 186.143.119.43

What do I need to change to see it through external networks?

This is my launchSettings.json file:

    {
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:51429",
      "sslPort": 44377
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "weatherforecast",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "WebAPI": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "weatherforecast",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

How to access this API from outside network ?

CodePudding user response:

If its for testing purposes consider using an service like ngrok.com

CodePudding user response:

You need to configure your ports and your IP in the rooter Idk how to do it but I early do it for a server for one of my game or you can use NGROK (I use it for temporary servers)

  • Related