silhouette hustler
silhouette hustler

Reputation: 1763

Switch to local database MVC application

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?

Upvotes: 0

Views: 82

Answers (2)

m5c
m5c

Reputation: 567

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.

Upvotes: 1

Richard Seal
Richard Seal

Reputation: 4266

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>

Upvotes: 2

Related Questions