In IIS, I can configure any number of DB connection strings on a given node:
When creating a new connection string, I can enter any name I like into the Name text box:
However, when editing the connection string, the Name text box is read-only:
Why is it read-only? Am I not supposed to change a connection string's name?
Note that I can still change the name, of course, by editing the underlying Web.config
file manually. And that is indeed what I've been doing several times now, but the fact that the UI won't let me change the connection string name after it has been created makes me wonder whether there are any problematic side-effects that I'm not aware of.
Background: The framework of the project I'm working on uses a fixed connection string name, "Default"
, to load the connection string in plenty of places. This way, quickly switching to another DB can only be done by renaming the connection string in IIS to Default, rather than changing some application setting to temporarily use a differently named connection string.
You can change the IIS site connection string name if its entry type is local. just click on the connection string in which you want to change the name and click on the rename from the action pane.
another way is to use iis configuration editor.
1)open IIS manager, select your site/virtual directory or application.
2)click on the configuration editor feature from the middle pane.
3)in configuration editor windows select the connection string from section drop-down:
4)click on the three-dot from the collection, select your connection string, and change the name and close the window and apply the changes.