Mindaugas
Mindaugas

Reputation: 1173

Umbraco cannot start after switching to local SQL database

I am trying to switch my SQL database from one on server to local replica of another one. In my SQL Server Manager studio I've created and restored DB from DB bak file and fixed user settings. In my local umbraco project I have connection String that looks like this:

<connectionStrings>
    <remove name="umbracoDbDSN" />
    <add name="umbracoDbDSN" connectionString="server=PCMINJACL2;database=MySites;user id=MySites_user;password=password" providerName="System.Data.SqlClient" />
  </connectionStrings>

I am not sure if I am missing something, because everytime I try to open the site I get this error message: Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database.

Any suggestions what it can be, because everything from server name to user to password are set to correct ones. So, I have no idea why it is not working. Thanks in forward for any help.

Upvotes: 1

Views: 3634

Answers (2)

Mahdi Abyaznezhad
Mahdi Abyaznezhad

Reputation: 522

You are facing this problem because of your connection string. I had this problem before. Based on the machine on which your SQL Server database is located there you should change your connection string. First You can use this way to make your connection. Then you can use the new connection string for sure.

  1. Open Visual studio--> View --> Server explorer
  2. Right-click on the Data connections--> Add Connection...
  3. In the Add Connection window you can try with different Data sources and server Ip addresses.

for my case,the windows was this

  1. Then you can press the Test connection button.
  2. After getting a successful message you can press the ok button.
  3. Then right-click on your connection and select properties. like this picture. enter image description here
  4. Then copy your connection string like this picture. enter image description here

Upvotes: 0

avs099
avs099

Reputation: 11227

so in my case what helped was replacing server=localhost;database=... in connection string with server=.\;database=... - it started to work right away.

Upvotes: 0

Related Questions