ASP.NET 5 Logging

Logging lets your application capture run-time information that can prove invaluable when debugging problems or analyzing performance issues.  ASP.NET 5 has a default logging implementation that logs to the console, debugger, event log, or to a trace source.  If these targets don’t meet your application’s needs, you can replace the default implementation with a third-party solution, or […]

ASP.NET 5 Configuration – Settings Classes

In earlier Configuration examples, we used IConfigurationRoot to access settings with a string key, which returned a string value.  In the following example, we’ll see how to configure typed access to settings. The code snippets shown here are from the command line example project. You can find both the command line project and a Visual Studio 2015 […]

ASP.NET 5 Dependency Injection – Bring Your Own Container

The default DI container that comes with ASP.NET 5 is basic, and doesn’t support all of the features found in third-party containers. In this post we’ll see how to replace the default container with StructureMap and Autofac. Keep in mind that the ASP.NET 5 integration for these containers were only recently released and may still […]

ASP.NET 5 Dependency Injection – Lifetimes

Dependency injection is a fundamental part of ASP.NET 5, and before we continue our discussion of configuration it will be helpful to see how we work with dependency injection in ASP.NET 5. This post assumes you understand Inversion of Control (IoC) and Dependency Injection (DI). In a nutshell, these principles allow us to keep our classes […]

ASP.NET 5 Configuration – Environment Specific Settings

ASP.NET 5 lets us use an environment variable named ASPNET_ENV to specify the environment that an application is running in (the variable can also be named Hosting:Environment). You can use any value for the environment name, but “Development”, “Staging”, and “Production” are used by convention. Note: In earlier releases of ASP.NET 5, the environment variable name […]

ASP.NET 5 Configuration – Using the Built-In Providers

In older versions of ASP.NET, configuration information was stored in XML files, with a machine.config file for machine-wide settings and one or more web.config files for ASP.NET site settings.  ASP.NET 5 introduces a new configuration system, allowing configuration information to come from files (JSON, XML, INI), environment variables, or custom configuration providers. In this post, we’ll […]