3

I was configuring my application for deployment. The first step I did was changing the environment from Development to Production and stumbled in this error. I noticed that I can launch my application only in the Development Environment. When I change them to Staging, Production I get the mentioned error. Also, I tried the solutions from this post, and still no success.

Here are the related configurations:

launchSettings.json

{
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:64845",
      "sslPort": 44375
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
    },
    "BingoAPI": {
      "commandName": "Project",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
    }
  }
}

xx.csproj

<PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
Gicu Mironica
  • 585
  • 8
  • 22
  • 1
    You might need to share your Startup.cs and your Program.cs in addition to web.config and full project file – pinkfloydx33 May 10 '20 at 21:48
  • 1
    If you want to set your `ASPNETCORE_ENVIRONMENT` to **production** state, you can just remove `environmentVariables` from your `launchSettings.json`. Read [docs](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-3.1) – Mateech May 10 '20 at 21:51
  • I noticed the application can run with the Production environment on the server. I guess then it's some operating system related stuff so I will leave it like that – Gicu Mironica May 12 '20 at 11:42

0 Answers0