Since I've got a local copy of my database server, I would like to change the server IP address in hosts file and point it to the local database. Is there any way of doing this without having to amend any piece of code?
2 Answers
Change the connection string in your web.config.debug file
You can change it using the xdt:Transforms Like this:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="name" connectionString="local connection string here" xdt:Transform="Replace" xdt:Locator="Match(name)" />
</connectionStrings>
</configuration>
Comments
It depends on how you've coded the application. If you have created the connection string inside the application , they you would need to change code . Or if the settings are in a config file . editing the config file should be enough.
If you have changed the host entry , check if the IP itself is accessible and the specific port is open or not.
Also do you need to authenticate differently ? Posting the stack trace might be helpful.
connection stringbased on where you want to connect. useweb.debug.configto do that