`, publishing the project creates a *web.config* file in the published output (the *publish* folder). For more information, see [Host ASP.NET Core on Windows with IIS](xref:host-and-deploy/iis/index#webconfig-file).
## Access configuration during startup
To access configuration within `ConfigureServices` or `Configure` during startup, see the examples in the [Application startup](xref:fundamentals/startup) topic.
## Adding configuration from an external assembly
An [IHostingStartup](/dotnet/api/microsoft.aspnetcore.hosting.ihostingstartup) implementation allows adding enhancements to an app at startup from an external assembly outside of the app's `Startup` class. For more information, see [Enhance an app from an external assembly](xref:fundamentals/configuration/platform-specific-configuration).
## Access configuration in a Razor Page or MVC view
To access configuration settings in a Razor Pages page or an MVC view, add a [using directive](xref:mvc/views/razor#using) ([C# reference: using directive](/dotnet/csharp/language-reference/keywords/using-directive)) for the [Microsoft.Extensions.Configuration namespace](/dotnet/api/microsoft.extensions.configuration) and inject [IConfiguration](/dotnet/api/microsoft.extensions.configuration.iconfiguration) into the page or view.
In a Razor Pages page:
```cshtml
@page
@model IndexModel
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
Index Page
Access configuration in a Razor Pages page
Configuration["key"]: @Configuration["key"]
```
In an MVC view:
```cshtml
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
Index View
Access configuration in an MVC view
Configuration["key"]: @Configuration["key"]
```
## Additional notes
* Dependency Injection (DI) isn't set up until after `ConfigureServices` is invoked.
* The configuration system isn't DI aware.
* `IConfiguration` has two specializations:
* `IConfigurationRoot` Used for the root node. Can trigger a reload.
* `IConfigurationSection` Represents a section of configuration values. The `GetSection` and `GetChildren` methods return an `IConfigurationSection`.
* Use [IConfigurationRoot](/dotnet/api/microsoft.extensions.configuration.iconfigurationroot) when reloading configuration or for access to each provider. Neither of these situations are common.
## Additional resources
* [Options](xref:fundamentals/configuration/options)
* [Use multiple environments](xref:fundamentals/environments)
* [Safe storage of app secrets in development](xref:security/app-secrets)
* [Host in ASP.NET Core](xref:fundamentals/host/index)
* [Dependency Injection](xref:fundamentals/dependency-injection)
* [Azure Key Vault configuration provider](xref:security/key-vault-configuration)