.NET Configuration (app.config/web.config/settings.settings)

Any configuration that might differ across environments should be stored at the machine level, not the application level. (More info on configuration levels.) These are the kinds of configuration elements that I typically store at the machine level: Application settings Connection strings retail=true Smtp settings Health monitoring Hosting environment Machine key When each environment (developer, … Read more

Avoid web.config inheritance in child web application using inheritInChildApplications

As the commenters for the previous answer mentioned, you cannot simply add the line… <location path=”.” inheritInChildApplications=”false”> …just below <configuration>. Instead, you need to wrap the individual web.config sections for which you want to disable inheritance. For example: <!– disable inheritance for the connectionStrings section –> <location path=”.” inheritInChildApplications=”false”> <connectionStrings> </connectionStrings> </location> <!– leave inheritance … Read more

How to implement a ConfigurationSection with a ConfigurationElementCollection

The previous answer is correct but I’ll give you all the code as well. Your app.config should look like this: <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <configSections> <section name=”ServicesSection” type=”RT.Core.Config.ServiceConfigurationSection, RT.Core”/> </configSections> <ServicesSection> <Services> <add Port=”6996″ ReportType=”File” /> <add Port=”7001″ ReportType=”Other” /> </Services> </ServicesSection> </configuration> Your ServiceConfig and ServiceCollection classes remain unchanged. You need a new … Read more

Add MIME mapping in web.config for IIS Express

Putting it in the “web.config” works fine. The problem was that I got the MIME type wrong. Instead of font/x-woff or font/x-font-woff it must be application/font-woff: <system.webServer> … <staticContent> <remove fileExtension=”.woff” /> <mimeMap fileExtension=”.woff” mimeType=”application/font-woff” /> </staticContent> </system.webServer> See also this answer regarding the MIME type: https://stackoverflow.com/a/5142316/135441 Update 4/10/2013 Spec is now a recommendation and … Read more

Query a parameter (postgresql.conf setting) like “max_connections”

You can use SHOW: SHOW max_connections; This returns the currently effective setting. Be aware that it can differ from the setting in postgresql.conf as there are a multiple ways to set run-time parameters in PostgreSQL. To reset the “original” setting from postgresql.conf in your current session: RESET max_connections; However, not applicable to this particular setting. … Read more

How to get config parameters in Symfony2 Twig Templates

You can use parameter substitution in the twig globals section of the config: Parameter config: parameters: app.version: 0.1.0 Twig config: twig: globals: version: ‘%app.version%’ Twig template: {{ version }} This method provides the benefit of allowing you to use the parameter in ContainerAware classes as well, using: $container->getParameter(‘app.version’);

Options, Settings, Properties, Configuration, Preferences — when and why?

Tricky, this, as there’s no one single consistent style followed by all applications. As you say they are (broadly) synonyms. In truth it doesn’t really matter so long as your expected audience understands what you mean. The biggest difference is between Properties, which usually affect a component or object, and the others, which affect the … Read more