DotNetNuke 4.x – Cryptic install error

A friend and co-worker today decided to experiment with installing the new .Net 2.0 version of DotNetNuke today. Now, our current website was developed on the 3.x dnn structure but i'd yet to have a look at the 4.x series. Turns out there is a particularly cryptic error message that can show up if your web.config isn't properly configured when you run the install.

The error shows as something along the lines of "Cannot find dbname_template.mdf file in xxx directory". After wasting a little time looking for the mdf file (it doesn't exist in any of the distribution files, in case you're wondering.) I got my friend – let's call him Cranky Prick – to send over his web.config file.

It turns out the new config file has two different sections for entering connection strings, and within those sections there are two possible formats. I'll demonstrate below:-

<!– Connection String for SQL Server 2005 Express –>
connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"
providerName="System.Data.SqlClient" />
<!– Connection String for SQL Server 2000/2005
<add name="SiteSqlServer" connectionString="Server=(local);Database=DNN;uid=DNN;pwd=DNN;" providerName="System.Data.SqlClient" />

This is the first connection string setting. AS you can see, there are two potential versions of "SiteSqlServer" there, and as the comments say, the first is for using SQL 2005 Express, the other is for using SQL 2000 or, I assume, 2005 full version. We were using 2000 so using that section was Cranky's first mistake. What we have to do is comment out the top and uncomment the bottom <add clauses.

The bottom clause wants a connection string that is more familiar to us in anycase.

Just below this there is another section, as seen below.

<!– Connection String for SQL Server 2005 Express – kept for backwards compatability – legacy modules –>
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"/>
<!– Connection String for SQL Server 2000/2005 – kept for backwards compatability – legacy modules
<add key="SiteSqlServer" value="Server=(local);Database=DNN;uid=DNN;pwd=DNN;" /> –>

Apparently these lines are for backwards compatibility with modules that wont handle the top lines properly. Again, we need to comment out the top <add statement and uncomment the bottom one, then fill it out with the same details we gave above.

Either using the wrong format (uncommenting/commenting the wrong one) or forgetting to fill in the second connection string is what causes that error. As far as I can tell, you don't actually need the mdf file its looking for (and I have no idea why it thinks it should need it.) It does mention the second connection string in the installation manual, but I can see how it would be easy to miss – Particularly if you dont READ it Cranky.

Looks about as smooth as a 3.x installation once thats sorted. Not that it isn't possible to come up with some nifty problems there 😉 Adios.