James Michael Lucas
James Michael Lucas

Reputation: 142

DNN Database Error Connection IIS7

So I am moving a DNN7 website from my local computer (the site has been developed in WebMatrix) to a Server running Windows Server 2008.

When I run the site I get the error. 'DNN Error Connection To The Database Failed'.

Now the strange thing is I downloaded Webmatrix on the 2008 Server and got the site to run fine, but running from IIS it does not work.

Why would it work for Webmatrix but not IIS?

Edit: My connection string is:

<add name="SiteSqlServer" connectionString="Server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Database=DNN2;Trusted_Connection=Yes;" providerName="System.Data.SqlClient" />

Any thoughts why this connection string wont work?

I keep getting 'Connection to the database failed.

Thanks

James

Upvotes: 4

Views: 5840

Answers (1)

Ryan Gunn
Ryan Gunn

Reputation: 1169

Please make sure you update both SiteSqlServer settings in your web.config. Look below to see an example. One is under <connectionStrings> and the other under <appSettings>

      <connectionStrings>
        <add name="SiteSqlServer" connectionString="Server=myServerName;Database=myDataBase;User Id=myUsername;
Password=myPassword;" providerName="System.Data.SqlClient" />
      </connectionStrings>

      <appSettings>
        <add key="SiteSqlServer" value="Server=myServerName;Database=myDataBase;User Id=myUsername;Password=myPassword;" />
      </appSettings>

Hope this helps

Upvotes: 3

Related Questions