IIS Connection String not being inherited
I have an issue where I've set up a connection string at the Machine level in IIS, and it is inherited all the way down as expected... EXCEPT for the application I want to use the string in. Other applications at the same level do inherit the string.
The application in the past had the connection string with the same name defined. Removing it at the application level removes it permanently: it will not be inherited. Adding it at the application level makes it local. I can't find a way for that application to inherit the connection string.
Is there some way to reset this behavior? Short of removing the application entirely?
Solution 1:
Open the AppHost configuration at C:\Windows\System32\inetsrv\config\applicationHost.config and search for the name of your app, review the matches, do any of them have to do with connectionstrings?
Does your app has a parent that may remove the connection string in question?
Solution 2:
I just had this same problem.
I had a connection string defined for the server node (in IIS), then clicked on Connection Strings on an application node under the default web site. I altered that, then decided that the alterations weren't needed so deleted the connection string from the application node.
This is what happened. The connection string was actually defined for the server, and inherited by the application node, therefore I wasn't actually deleting it from the application node, what I was actually saying was, "I don't want this application to inherit this connection string".
I've deleted it so may not have the config exactly right but IIS implemented this by adding something like the following into web.config for the application:
<connectionstrings>
<remove name="connstringname"... />
</connectionstrings>
So, the fix is to edit web.config and remove that entry, your application will then be able to inherit the connection string from the higher node.