14 Configuring and publishing your application

 

This chapter covers

  • Understanding and managing environments
  • Managing application configuration with app settings
  • Improving performance with caching
  • Publishing your application

We got there! Well, almost. You’ve written your application and made sure it is secured against external threats. It’s virtually ready to go live, but there are one or two things you need to attend to first, and this final chapter will wrap those up before walking through the publishing process.

The source of most issues that arise after an application has been deployed to a production web server is the difference between the development environment and the hosting environment. Various configurations, such as database connection strings or mail server settings, will often differ between the two environments. We will explore how ASP.NET Core helps you manage the differences between these environments seamlessly, using the environments concept I have referred to a few times throughout this book. In addition, you will take a much closer look at the primary means for storing application configuration data—the appSettings.json file—and learn several ways you can read its contents at runtime.

14.1 Working with environments

14.1.1 Understanding and managing environments

14.1.2 Setting the environment

14.1.3 Registering services conditionally for each environment

14.1.4 The IHostEnvironment service

14.1.5 The environment tag helper

14.2 Application configuration

14.2.1 appSettings.json

14.2.2 Accessing configuration settings programmatically by key

14.2.3 Strongly typed app settings

14.2.4 Using the options pattern

14.2.6 Environments

sitemap