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?
Asked
Active
Viewed 76 times
0
-
1change `connection string` based on where you want to connect. use `web.debug.config` to do that – harishr Sep 29 '15 at 08:28
-
That's what the config is for, just change your connection string. If you _really_ want to fake a host, what have you tried? Editing your hosts file is documented very thoroughly on the web. – CodeCaster Sep 29 '15 at 08:29
-
@entre Is there any possibility of doing this without amending the code itself? – threesixnine Sep 29 '15 at 08:29
-
@CodeCaster I've tried to point my database server to the local host IP and it didn't work. – threesixnine Sep 29 '15 at 08:30
-
2With "it didn't work" we can't do much. – CodeCaster Sep 29 '15 at 08:30
-
its not code change.. its config – harishr Sep 29 '15 at 08:33
-
@entre I see, should I modify only the config file without messing with the hosts? – threesixnine Sep 29 '15 at 08:34
-
@CodeCaster Sorry, you are right, I've got an error : HTTP Error 500.0 - Internal Server Error – threesixnine Sep 29 '15 at 08:35
-
1http://stackoverflow.com/questions/5385714/deploying-website-500-internal-server-error – CodeCaster Sep 29 '15 at 08:36
-
1exactly.. only config, without messing with hosts – harishr Sep 29 '15 at 09:04
2 Answers
2
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>

Richard Seal
- 4,248
- 14
- 29
1
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.

m5c
- 567
- 8
- 13