Reputation: 3245
I was getting an error saying that one of my connection string in my application's web.config file was already defined.
I checked in the IIS settings and when I checked the connection string property it was there already with Entry Type : Inherited.
So I went up the chain and went all the way up to the root of the localhost and checked the connection strings there.
I found a bunch of connection strings there as well.. but they're also all with Entry Type Inherited..
I checked the web.config file inside the wwwroot folder but didn't find any connection strings defined in there..
Where could these connection strings be coming from?...
Upvotes: 4
Views: 7124
Reputation: 151604
Configuration files in .NET are inherited in the following order:
systemroot\Microsoft .NET\Framework\versionNumber\CONFIG\Machine.config
systemroot\Microsoft .NET\Framework\versionNumber\CONFIG\Web.config
(ASP.NET only)(application directory)\Web.config
So the connection strings that show up as "inherited" are specified in either of the upper two files.
Reference: MSDN: ASP.NET Configuration File Hierarchy and Inheritance
If you don't want to alter the machine-wide configuration, you can <clear />
them from being inherited in your application's configuration as explained in What does <clear /> signify when specifying a connectionstring?:
<connectionStrings>
<clear />
<add name="LocalSqlServer" connectionString="..." />
</connectionStrings>
Upvotes: 6