I have the following connection string declared in my app.config file:
The first syntax is definitely valid.
The possible cause is that the configuration file is not loaded properly in the application. I want to ensure what type of project it is. If it is a WinForm application or Console application, you need set the in the app.config. It will be compiled to .config and loaded when the application is launched. If it is a Web application, I'm afraid you cannot add the node to app.config, since it will not be loaded. You need to put it in the web.config. In addition, if you want to put the settings in the config file with a .net library (DLL), the configuration file will not be loaded anyway. The configuration file will only follow the main application.