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.
Related
So in my /config/environments/*/database.json under my connections field, I declared another DB connection to redis.
I know accesing the model will fall down to the default ( which is MongoDB for this scenario), but how can I use my redis connection if I want to use it instead of the default?
If you are using the content type builder plugin to create a new content type, in the modal where you chose the content type name, you will see a dropdown for the connection you want to use.
If you have already created the content type, in the ./api/:name/models/:Name.settings.json file you will see a connection key.
You will have to replace the value with your connection name.
I have a .Net web application whose connection string i am trying to change using command line tool appcmd (available in C:\Windows\System32\inetsrv).
Is it feasible coz i am not able to do it after trying multiple attempts.
No direct reference is available for this but i am trying to use below mentioned query in terms of connection string.
appcmd set config /section:applicationPools /[name=’MyAppPool’].processModel.identityType:SpecificUser /[name=’MyAppPool’].processModel.userName:MyDomain\MyAccount /[name=’MyAppPool’].processModel.password:MyAccountPassword
so my query would become
appcmd set config /section:connectionStrings /[name=’ConnectionStringName’].password:test
but its not working. I am trying to change few more entries in connection string but not able to change even one.
As a work-around, i am deleting the existing connection string and adding a new one with same one and settings i need. But there must be a simpler way to do this.
Can anybody help in resolution?
I will really appreciate that.
I found the answer after some googling. Below is the required connection string I was looking for
C:\Windows\System32\inetsrv\appcmd.exe set config "Default Web Site" /section:connectionStrings /+"[name='TestString', connectionString='Data Source=TestDBServer\SQLEXPRESS; Initial Catalog=TestCatalog;User Id=sa;password=test', providerName='System.Data.SqlClient']"
Please note the + sign before 'name'. It's assuming that no connection string is available with this name. If it does, remove it first and then perform the above step.
Hope it helps.
I have backed up the Kentico Database and website from one of our Live servers and placed it within our Dev server and configured the website in IIS.
When I navigate to the website, it currently asks for New installation.. Whereas it should just show me the current website.
How do I get it to show the website?
EDIT
The following error occurs when going ahead and creating a new instance with the restored Database:
Restore the backed up database and add database connection string to the web.config of the application. Simple as that :)
Who or what is set as the DB objects owner/schema in the DB? Does this match the setting in Site Manager (or, CMS_SettingsKey table)? I would make sure these two match.
Another option is that the connection string was not initialized by .Net - I would do a dummy change in the web.config file to force the app restart and/or also clearing the .Net cache.
In my project I declare the one string like public string str="dbname";,
that string value use the overall application.
Where can I declare that string?
Another problem is that I can change that string value after publishing the site in iis,
(or)
I am giving client that time also change the string value, so where I can declare the variable?
please give me any suggestion.
dbname is string value so i can chage that name after publishing or any time
thank u
hemanth
DBName is something that belongs in a configuration file. ASP.NET uses files that are called web.config and they can store 'Connection strings', Application specific settings and other settings.
A configuration file can be edited after the program has been deployed to a production server. You can even automate this process so the settings are automatically set if you, for example, deploy to a test server, an acceptance or a production server.
Here is some documentation about how to use configuration files.
You have a client/server architecture?
You want your server application to use a global variable str?
You want your client application (which is a webinterface?) to change str?
I have a silverlight web project using LinqToSql for database connection. I developed it on my local SQL box using the local name of database. Now, when i deploy it on my production web server, do i have to recompile the code again to change the connection string for production db or just changing the db name in web.config will work.
Also, do i have to give specific username/password in the web.config file or dbml will pick that from IIS AppPool.
When you create your app in .net 4, you will get 3 web.config.
the live connection string should be put into the web.live.config.
just search for it for guidelines.
You dont have to recompile, but you have to point your linq to sql default constructor to use the connection string from web.conf
in web.conf use the connection sring with user name and password for the new server and you will not have to set password or username any where else.
please refer to this article for more help
http://aspilham.blogspot.com/2011/01/how-do-i-set-connection-string-in-linq.html