Utlizing the Runtime Settings Schema in your app.config is (primarily) about customizing run-time execution of your program to facilitate optimal performance.
Introduction to the runtime element and implementation in .NET 1.1
The
runtime element of the app.config file appears as a
sub-element of the
configuration element. It defines how the .Net runtime should behave when running your application. The exciting thing is you can change the runtime behaviour of your application, insofar as it relates to the .Net runtime, by customising the
runtime element of your app.config file, without recompiling your application.
The
Runtime Settings Schema was first introduced in .Net 1.1 with the feature of being able to enable or disable garbage collection on a separate thread (gcConcurrent enabled="true"). The setting in app.config overrides the corresponding setting in the machine.config. A simple use case for this feature would be a GUI application with significant user interaction, which you wouldn't want interrupted by gc pauses. Therefore, you would set gcConcurrent to true.
The
runtime element also supported from an early stage, assembly binding redirection, henceforth referred to as
ABR. This was (and still is) done via the
assemblyBinding child element of runtime.
To explain
ABR (and how it relates to
strong-named assemblies) -
Assume you have built your .Net application against a
specific version of a
strong-named .Net assembly. Note: you
cannot redirect versions of assemblies that are
not strong-named.
The application will surely use that assembly at runtime!
Suppose you want to refer to a newer version of this assembly. Yes you can via the app.config runtime->assemblyBinding element. In addition to app.config, machine.config or
publisher policy file are also valid ways of implementing
ABR for your application
.
With gcConcurrent and assemblyBinding elements fully described, we conclude our discussion on .NET 1.1 features implemented in the runtime element of the Configuration File Schema.
.NET 2.0 Features of the runtime element (Recognition of Multicore)
With .Net 2.0 the
gcServer element came into being. This specifies whether the Common language runtime runs server garbage collection. This makes sense when you have more than two CPUs.
.NET 4.0 UseSmallInternalThreadStacks
This is a request to the CLR to reduce memory usage by using
explicit stack sizes (instead of the default stack size it uses internally).