0

I know that you can define the ENVIRONMENT in asp.net core. Going to Properties --> Debug --> Environment Variable. I've added another environment DemoLocalEnvironment. The idea is to run the application in my local Windows 10 IIS.

"MyApplication": {
  "commandName": "Project",
  "launchBrowser": true,
  "launchUrl": "api/values",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "DemoLocalEnvironment"
  },
  "applicationUrl": "http://localhost:5003"
}

After I publish the application to the appropriate folder and setup IIS, none of my conditional code is being executed, the application is even crashing.

How to tell IIS which environment the application is supposed to run under?

Richard77
  • 20,343
  • 46
  • 150
  • 252

1 Answers1

0

Following the link posted by @Lex Li, I found many solution. The one that worked for me is adding this piece of code in the .csproj file.

<PropertyGroup>
  <EnvironmentName>DemoLocalEnvironment</EnvironmentName>
</PropertyGroup>
Richard77
  • 20,343
  • 46
  • 150
  • 252