1

Is there a performance hit when placing your DB connection strings in the machine.config instead of in your application's web.config or app.config?

I feel it should be a negative hit on performance, but surely it should be negligible.

eyesuc
  • 118
  • 1
  • 7
  • 4
    I would have thought the time spent reading config settings whether they be machine; web or app.config to be irrelevant compared to the time it takes to actually open a database connection. –  Nov 16 '15 at 12:34
  • This might be a possible [duplicate](http://stackoverflow.com/questions/1184187/storing-connection-strings-in-machine-config-vs-storing-them-in-web-config). Please check. – Kaushal B Nov 16 '15 at 12:55
  • @KaushalB I believe the other question is more Security related whilst this question specifically asks about performance – fluf Nov 16 '15 at 13:00

2 Answers2

2

The question is rather a non-question.

The machine.config always gets loaded, the app.config (or web.config) when it exists. Given both files are to be loaded, the difference is non-existent.

If you don't have an application configuration, the system can skip the loading of that file - but that difference will obviously be negligible.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
0

Looking at the MSDN Documentation it would appear that if there is anything to lose or gain performance wise it would most like gain. Although I doubt it would be noticeable.

The configuration system first looks in the machine configuration file for the appSettings Element (General Settings Schema) and other configuration sections that a developer might define. It then looks in the application configuration file.

fluf
  • 1,261
  • 2
  • 22
  • 36