Changing database server in CMS5

Vote:
 

Hi

We have a database on one server, but this server was only a temporary solution and we now need to move the episerver database to a different server. On the new server we have created a new instance of a database server called Instance_02 and I have restored a backup of the original database to this server. But when I change the connection string in connectionstrings.conf from "..Data Source=172.16.50.155.." to "..Data Source=172.16.50.159\Instance_02.." I only get a white page and an error in the errorlog:

EPiServer.Core.EPiServerException: Failed to connect to database using connection string with name 'EPiServerDB'
   at EPiServer.DataAccess.DataAccessBase.Initialize(ConnectionStringSettings connectionSettings, TimeSpan queryTimeout, Int32 deadlockRetries, TimeSpan deadlockRetryDelay)
   at EPiServer.Web.InitializationModule.<>c__DisplayClass32.<Initialize>b__10()
   at EPiServer.Web.InitializeEngine.Initialize()
   at EPiServer.Web.InitializationModule.Initialize(EPiServerSection config, Settings settings, ConnectionStringSettingsCollection connectionStringSettings)
   at EPiServer.Web.InitializationModule.<StaticInitialization>b__2()
   at EPiServer.Web.InitializeEngine.Initialize()
   at EPiServer.Web.InitializationModule.StaticInitialization()
   at EPiServer.Web.InitializationModule.Application_BeginRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
2010-06-16 15:30:52,784\t(null)\t1.2.5 Unhandled exception in ASP.NET
2010-06-16 15:30:52,877\t(null)\t1.2.5 Unhandled exception in ASP.NET
2010-06-16 15:30:52,877\t(null)\t1.2.5 Unhandled exception in ASP.NET

Have I written it wrong in connectionstrings.conf, both port 1433 and 1434 is open through the firewall and the local firewalls on each server is disabled?

Any ideas?

#40751
Jun 16, 2010 15:40
Vote:
 

1. Check whether the sql server allows connections through TCP/IP. You can do this using Sql Server Configuration Manager - expand 'SQL Server Network Configuration' and check 'Protocols for MSSQLSERVER' whether TCP/IP is enabled.

2. Try to connect to the database using SQL Server Management Studio (using SQL Server Authentication and the same credentials which are used in connection strings)

#40752
Jun 16, 2010 16:03
Vote:
 

And one more thing to check, which I'm always forgetting - check if you have changed "Server authentication" to "SQL Server and Windows Authentication mode".

 

regards,

Dominik 

#40786
Jun 17, 2010 8:43
Vote:
 

You did not include the complete data source (as I interpret .. before the "), is there any chance you have specified a port? Because if you specify both a named instance and a port the port will take precedence and you might be connecting to the wrong instance if your named instances use dynamic ports.

#40794
Jun 17, 2010 12:12
Vote:
 

Hi, I actually forgot to add the mixed mode Authentication mode for the database server. I also had to change the listening port for the Instance_02 from 1433 to 1434 and set this port in the TCP/IP configuration on the database-server. After I had done this it was easy just to change from 172...155 to 172...159/Instance_02,1434. So now it works, but it seems there was a conflict on the listeningport 1433 since i actuallty tried to put that port there before. But as soon as I changed the Port in both episerver and sql-server it started to work.

Thank you all.

#40800
Jun 17, 2010 13:44
Vote:
 

If you set a specific port for your named instance and include the port number in your data source you shouldn't need to include the instance came aswell, 172...159,1434 should do the trick. Not that a few extra chars matter :)

#40804
Jun 17, 2010 14:32
Vote:
 

In my case it is 

"SQL Serverand Windows Authentication mode".

TCP/IP is enabled

And Database is in SQLExpress and it is running, connection to database is tested through Visual Studio "Server Explorer" by adding new "Data Connection" and testing it.But I get this error:

EPiServer.Core.EPiServerException: Failed to connect to database using connection string with name 'EPiServerDB'

 

What do you think could be the reason ?

#50425
May 02, 2011 13:20
Vote:
 

Okay, by changing AppPool for the website from ApplicationPoolIdentity to LocalSystem solved the issue.

 

yet Not sure if it is correct solution.

#50524
May 04, 2011 12:07
Vote:
 

Hi,

I am getting this error but am unable to understand the reason. Is there some setting in Web.config that needs to be done.

When I run the code from the Visual Studio solution, it runs fine. But when I am trying to run the website through the IIS by putting my machine IP Address in the url, I get this error. For running the website through the IIS, I have changed the siteurl in the web.config as siteUrl=http://172.11.156.54/Alias/

While running the code from the solution I use siteUrl =http://localhost:4238/

 Here is my connectionstrings.config tag --> 
 <add name="EPiServerDB" connectionString="Data Source=vm-sql-1;Initial Catalog=dbTNo;Integrated Security=False;User ID=testU;Password=NewTestUser123;Connect Timeout=10" providerName="System.Data.SqlClient" />

This database connection works fine when I log in through SQL Management Studio. Also, as suggested here I have enabled the TCP/IP properties and the SQL connection is running in Mixed Authentication mode.

Please help.

Error -->
Failed to connect to database using connection string with name 'EPiServerDB'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: EPiServer.Core.EPiServerException: Failed to connect to database using connection string with name 'EPiServerDB'

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[EPiServerException: Failed to connect to database using connection string with name 'EPiServerDB']
   EPiServer.DataAccess.DataAccessBase.Initialize(ConnectionStringSettings connectionSettings, TimeSpan queryTimeout, Int32 deadlockRetries, TimeSpan deadlockRetryDelay) +335
   EPiServer.Web.InitializationModule.InitializeDataAccess(ConnectionStringSettings connectionStringSettings, Settings settings) +86
   EPiServer.Web.<>c__DisplayClass32.<Initialize>b__10() +42
   EPiServer.Web.InitializeEngine.Initialize() +228
   EPiServer.Web.InitializationModule.Initialize(EPiServerSection config, Settings settings, ConnectionStringSettingsCollection connectionStringSettings) +1267
   EPiServer.Web.InitializationModule.<StaticInitialization>b__2() +34
   EPiServer.Web.InitializeEngine.Initialize() +228
   EPiServer.Web.InitializationModule.StaticInitialization() +737
   EPiServer.Web.InitializationModule.Application_BeginRequest(Object sender, EventArgs e) +484
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

#52711
Edited, Aug 10, 2011 15:36
Vote:
 

The name of your SQL server suggest you run several virtual machines on your computer? Can they all reach each other? I mean, it's obivious that the machine you use Visual Studio on can connect to the SQL machine. But can the machine that is running IIS?

#52734
Aug 11, 2011 7:33
Vote:
 

You are right Magnus. I am working with Virtual machines. IIS is running on my virtual machine. As well as the code solution is also running on my virtual machine.

So they are both able to connect to the database server. Unfortunately this error is also not creating anything in the SQL server log on the server.

Am not able to understand what is wrong? :(

#52768
Aug 12, 2011 13:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.