0

I have been struggling to run my NetCore 3.1 Web Api project as localhost in IIS for debugging. I do not have much experience with this, and would like some advice.

The project runs fine published in Azure, but of course while its in Azure i cannot debug, so definitely need to be able to run it locally as well.

I am assuming there is an issue with the ports, but my question is, how do I select the ports properly?

These are my current settings in:

launchSettings.json

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:5001",
      "sslPort": 44393
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "api/accounts/register",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "ancmHostingModel": "OutOfProcess"
    },
    "YWAW.WebApi": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "api/accounts/register",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001;http://localhost:5000"
    }
  }
}

appsSettings.json

{
  "Tokens": {
    "Key": "MYSECRETKEY",
    "Issuer": "localhost.com",
    "AccessExpireSeconds": "86400"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*"
}

Project Settings

Razvan Emil
  • 533
  • 9
  • 25
  • 3
    According to the error message, I guess the 5001 port may be used by other application. I suggest you could try below steps to modify the port name and try again. 1.Close Visual Studio 2.Delete the .vs directory in the solution folder3.Restart Visual Studio4.Change project to run on another port and debug it – Brando Zhang Jun 22 '20 at 05:56
  • 1
    Does this answer your question? [Unable to launch the IIS Express Web server](https://stackoverflow.com/questions/15873126/unable-to-launch-the-iis-express-web-server) – Michael Freidgeim Jul 15 '21 at 01:32

0 Answers0