Installing DotNetNuke : Database Connection Failin

2019-02-21 00:00发布

问题:

I am trying to setup DNN on my local machine but having following error.

Installing DotNetNuke

Upgrade Error: ERROR: Could not connect to database specified in connectionString for SqlDataProvider

I have a SQL Server 2014 Express installed with custom login created. I can login and access to database with same credentials using SQL Management Studio.

In web.config file, I have following lines for Database connection:

<connectionStrings>
<add name="SiteSqlServer" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=<dbName>;User ID=<UID>;Password=<PWD>" providerName="System.Data.SqlClient" />
<add name="SiteSqlServerAcuity" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=<dbName>;User ID=<UID>;Password=<PWD>" providerName="System.Data.SqlClient" />
<add name="AcuityEntities" connectionString="metadata=res://*/DAO.Model.SalesAcuity.csdl|res://*/DAO.Model.SalesAcuity.ssdl|res://*/DAO.Model.SalesAcuity.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;Initial Catalog=<dbName>;Persist Security Info=True;User ID=<UID>;Password=<PWD>;MultipleActiveResultSets=True;Application Name=EntityFramework&quot;" providerName="System.Data.EntityClient" />

and

<appSettings>
<add key="SiteSqlServer" value="Data Source=.\SQLEXPRESS;Initial Catalog=<dbName>;User ID=<UID>;Password=<PWD>"></add>
</appSettings>

I verified and changed connectionstrings in both sections as per so many references on internet but none of them worked.

Is there any other configuration needed? Or any change needed in web.config or Database configuration ?

THIS IS NOT A DFAULT DOTNETNUKE PACKAGE. ITS A CUSTOM PROJECT I AM TRYING TO SETUP.

回答1:

There are a few things to consider, depending on the nature of the setup that you have.

  1. Ensure that the Web Server can connect to the DB server. You may be able to connect to the server, but the web server itself cannot
  2. Ensure that the user account being used has DBO rights, if DNN needs to upgrade etc it needs that level of permissions


回答2:

This is more of a comment to @Mitchel Sellers answer, point 1. But it's a bit too much for a comment field.

  1. Run the SQL Server Configuration Manager.
  2. Go to "SQL Server Network Configuration".
  3. Click "Protocols for <INSTANCE>".
  4. In the right pane double click on "TCP/IP".
  5. Make sure that "Enabled" is set to "Yes".
  6. Go to the tab "IP Adresses".
  7. For each IP, set the "TCP Port" to "1433", the "TCP Dynamic Port" to "0" and "Active" and "Enabled" to "Yes".
  8. With "IPALL" just set the port to "1433", leave the Dynamic as is.
  9. Reboot or restart the SQL Server service.

With these steps I get a connection to the database from IIS using localhost

If you cannot find the Configuration Manager in the Start Menu, you can run it manually with C:\Windows\SysWOW64\mmc.exe /32 c:\Windows\SysWOW64\SQLServerManager12.msc