Configure .NET Core with environment variables

If you are using IIS, you can configure application settings for the .NET Core agent by adding environment variables using the web.config file or in launchSettings.json.

Tip

You can convert any of the properties in the .NET Core YAML template to environment variables.

  • To change the agent's logging level (agent.logger.level) to "TRACE", add a setting with key CONTRAST__AGENT__LOGGER__LEVEL and value "TRACE".

  • To change the agent's server name (server.name) to "MyServer", add a setting with key CONTRAST__SERVER__NAME and value "MyServer".

Here are some of the most common settings:

Environment variable

Purpose

CONTRAST__APPLICATION__NAME

Specify the application name reported to Contrast.

CONTRAST__APPLICATION__GROUP

Specify the access group for this application. (You must have already created access groups.)

CONTRAST__APPLICATION__SESSION_METADATA

Provide metadata which is used to create a new session ID in the Contrast web interface. Vulnerabilities discovered by the agent are associated with this new session.

CONTRAST__SERVER__NAME

Specify the server name reported to Contrast.

CONTRAST__SERVER__ENVIRONMENT

Specify in which environment the application is running (Development, QA and Production).

See the .NET Core YAML template for a description of other available properties.