While using a third party dll I was getting the following exception:
exePath must be specified when not running inside a stand alone exe
with the following trace
System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath).
The reason I found was that it was looking for app.config and I had provided the details in web.config. My question is: why does the system.configuration differentiate between web.config and app.config? Any thoughts?
Web. Config is used for asp.net web projects / web services. App. Config is used for Windows Forms, Windows Services, Console Apps and WPF applications.
The <appSettings> element of a web. config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work.
App. Config is an XML file that is used as a configuration file for your application. In other words, you store inside it any setting that you may want to change without having to change code (and recompiling). It is often used to store connection strings.
Executables:
Several .NET executables can live in the same directory. As there cannot be two files with the same name in the same directory, the applications must use different names for their main configuration files. The applicationName.exe.config
scheme solves this.
Web applications / sites:
.NET web applications are compiled to DLLs, and web sites are usually compiled just-in-time. Hence, there is no "main entry point" in these types of projects. It is possible to create a web project where each page is compiled to its own assembly. Which one is the main assembly? Which assembly should we name the configuration file after?
Fortunately, only one web project can be hosted from a single directory, so only one main configuration file is going to live here. This allows for the main configuration file name to be picked by convention, and that file name happens to be web.config
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With