Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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?

share|improve this answer
    
I did this. None of the app matches had any mention of connection strings. After a bit of playing round I found out changing the App Pool allowed the application to inherit the connection string. I'm not sure why that would be. –  TastyPorkChop May 4 '12 at 19:54
    
If the App Pool was configured to use a different version of .NET from the others, that might be the cause. There is a machine.config for each version of the framework. –  Chris McKeown May 4 '12 at 21:49
    
@ChrisMcKeown Ah! After a long bit of work it turns out it was the .NET version of the App Pool config. More specifically: the .NET version at the machine level in IIS manager was defaulting to v2.0 and the app had a pool set to v4.0. Right clicking in the features view choosing "Change .NET Framework Version", switching to v4.0 and setting the connection string there had the proper effect. –  TastyPorkChop May 15 '12 at 14:56

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.