0

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?

10
  • 1
    change connection string based on where you want to connect. use web.debug.config to do that Commented Sep 29, 2015 at 8: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. Commented Sep 29, 2015 at 8:29
  • 2
    With "it didn't work" we can't do much. Commented Sep 29, 2015 at 8:30
  • 1
    stackoverflow.com/questions/5385714/… Commented Sep 29, 2015 at 8:36
  • 1
    exactly.. only config, without messing with hosts Commented Sep 29, 2015 at 9:04

2 Answers 2

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>
Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.