arthurh88
asked on
best practice for SQL connection string?
My IIS7 ASP.NET website is hosted on the same Win 2008 server as my SQL 2008 R2 database.
My web applications have my SQL connection string in the web.config file. It looks like this:
connectionString="Data Source=mydomain.com.....
Would connections speed up if I did something like DataSource = Localhost or the private-side IP, or something like that? Is what Im doing the best practice? I favor browsing speed for the end user (web visitor) above all else
My web applications have my SQL connection string in the web.config file. It looks like this:
connectionString="Data Source=mydomain.com.....
Would connections speed up if I did something like DataSource = Localhost or the private-side IP, or something like that? Is what Im doing the best practice? I favor browsing speed for the end user (web visitor) above all else
I always use localhost mainly because it makes it easy to copy from dev to staging to production. It makes it technically faster because there is no DNS lookup but I don't think you would notice as its cached after the first time.
From my perspective, this is best practice in terms of scalability:
Plan on ultimately having seperate application and SQL servers
Use DNS because eventually you will may need to change physical configuration and ultimately this will cause least interruption to your users
Plan on ultimately having seperate application and SQL servers
Use DNS because eventually you will may need to change physical configuration and ultimately this will cause least interruption to your users
Please do not use Localhost. This is bad practise.
Use ServerName exactly. Even IP leads to confusion sometimes.
Better store encrypted string in web.config file where you can decrypt in application for security purpose.
http://www.codeproject.com/Tips/304638/Encrypt-or-Decrypt-Connection-Strings-in-web-confi
http://chiragrdarji.wordpress.com/2008/08/11/how-to-encrypt-connection-string-in-webconfig/
Use ServerName exactly. Even IP leads to confusion sometimes.
Better store encrypted string in web.config file where you can decrypt in application for security purpose.
http://www.codeproject.com/Tips/304638/Encrypt-or-Decrypt-Connection-Strings-in-web-confi
http://chiragrdarji.wordpress.com/2008/08/11/how-to-encrypt-connection-string-in-webconfig/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are one step ahead of me and I salute you ! :-)
ASKER
why is local host a bad practice? can someone explain that please?