What is the most suitable exception thrown if the required app / web.config configuration parameter is missing?

(Answered by @tomhollander on Twitter) What is the most appropriate exception thrown if the required app / web.config configuration parameter is missing?

+4
source share
2 answers

Exception configuration is deprecated. The docs say that it was replaced with a ConfigurationErrorsException , but it is intended to convey failures in the configuration system - I do not think it is intended to display problems such as missing or incorrect configuration values.

+1
source

System.Configuration.ConfigurationException

According to MSDN (highlighted by me):

A ConfigurationException is thrown if the application tries to read or write data to the configuration file, but is unsuccessful. Some possible reasons for this may be incorrect XML in the configuration file, permission file, and configuration properties with values ​​that are not valid .

+7
source

All Articles