2

I have configured a dev cert in my project. The cert path is in my HOME directory.

When I configure environment variable ASPNETCORE_Kestrel__Certificates__Default__Path, none of

$HOME/.aspnet/https/localhost.pfx
$(env:HOME)/.aspnet/https/localhost.pfx
${HOME}/.aspnet/https/localhost.pfx

works. Now I set it to /home/nemo/.aspnet/https/localhost.pfx and it can run normally.

I refer to this answer, but it seems to only work on PowerShell, while I use zsh.

1 Answer 1

-2

You need to set environment variables on the server:

**LINUX**

export ASPNETCORE_ENVIRONMENT=Staging

**POWERSHELL**

$Env:ASPNETCORE_ENVIRONMENT="Staging"

**WINDOWS**

set ASPNETCORE_ENVIRONMENT=Staging

Reference document:

Use multiple environments in ASP.NET Core

Sign up to request clarification or add additional context in comments.

2 Comments

It seems to be the configuration of the entire OS, but I only want to configure it for this project.
Do you want to configure the environment for this project separately in launchSettings.json? You can refer to the practice of this post, it may be helpful to you:stackoverflow.com/questions/52883707/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.