DNN 4.0.3 Installation
Notes and corrections when running several, physically separated DNN application instances within same Database
Introduction:
I have downloaded the DNN 4.0.3 Source Package and with the documents attached I was able to install DNN within minutes. Hurrey !
Problems have started when I have tried to install a second DNN 4.0.3 application instance on a second machine/server with same connection string but different objectQualifer set in web.config (e.g I am using “bsDev_” prefix and “bsProd_” prefix to distinguish DB objects used by either the Development or the Productive DNN application instance).
As it took me about 2 days analysing the problems that have come with the second installation, I thought maybe its good to share my insights with you.
And Yes – finally all runs fine now.
My Environment :
Development Application Server
- XP Professional German Version
- IIS 5.0
- Visual Studio 2005 Professional
- DNN 4.0.3 Source Package
-
Externally hosted Productive Application Server
- Windows 2003 Server
- IIS 6.0
Database (for both instances)
- SQL Server 2005 externally hosted at Centron.de
Special Installation Needs / Requirements
1. External Hosting
The SQL 2005 Database is externally hosted with limited Administrative Access Rights (e.g. cannot drop/recreacte a database à have to drop all objects manually by running a custom made script (DropAllDbObjectsFromDNN403Version.sql).
2. Several DNN instances on same DB
I am running several instances of DNN application on different application servers against a single (always the same) logical Database.
Issues
Issue #1:
Errors in Version 4.0.3 DotNetNuke.Schema.SqlDataProvider and DotNetNuke.Data.SqlDataProvider scripts
Problem
When running the installation for the second installation (creating a second local DNN installation on a different application server that refers to the same physical DB with different objectQualifier set) I have got the following errors when running the script for the second time:
System.Data.SqlClient.SqlException: There is already an object named 'PK_EventLogMaster' in the database.
Could not create constraint. See previous errors.
...snip...
ALTER TABLE ce56093.[bsDev_EventLog] ADD CONSTRAINT [PK_EventLogMaster] PRIMARY KEY CLUSTERED ([LogGUID])
System.Data.SqlClient.SqlException: There is already an object named 'PK_EventLogTypes' in the database.
Could not create constraint. See previous errors.
...snip...
ALTER TABLE ce56093.[bsDev_EventLogTypes] ADD CONSTRAINT [PK_EventLogTypes] PRIMARY KEY CLUSTERED ([LogTypeKey])
System.Data.SqlClient.SqlException: There are no primary or candidate keys in the referenced table 'ce56093.bsDev_EventLogTypes' that match the referencing column list in the foreign key 'FK_bsDev_EventLog_bsDev_EventLogTypes'.
Could not create constraint. See previous errors.
...snip...
Analysis
For any reasons there are two objects in the script - “PK_EventLogMaster” and “PK_EventLogMaster” - without a leading objectQualifer prefix. So when running the script for the second installation this leads to duplicate keys. The consequence is, that no Data at all will be loaded as the DotNetNuke.Schema.SqlDataProvider script will be rolled back completely (All the script’s statements run in the same transaction that halts and completely rolls back at any SQL Exception occuring).
Solution
Have added an {objectQualifer} „Tag“ to all objects of the DotNetNuke.Schema.SqlDataProvider and DotNetNuke.Data.SqlDataProvider script.
Pending Items:
Still not sure whether this is just a bug or whether this has been done on purpose. When yes, I am not aware yet of the consequences of my correction and would be happy when someone could comment on this.
Issue #2:
Cannot use same Host and AdministratorIDs nor the same Roles for a second installation
Problem
The installation process fails silently when using the same AdministratorID or Roles for the second DNN installation.
Even worse, when using the same host account all the installation process looks fine without any errors BUT you will not be able to login afterwards with your host account!
Although I am not sure whether this is a bug or whether this something made on purpose to comply with ASP.NET 2.0 Membership, I think this issue is not well ( when at all ) documented.
Analysis
After having solved Issue#1 I still have got the message that my Portal cannot be installed. Period. No further indications for potential reasons for this failure. No log entries. Nada.
Tracing the application then revealed, that the UserIDs and Roles specified in the template file are added to the aspnet membership tables as well, where (of course) they would have created doublicate keys with the ones from the first installation.
Upon this (and this is the not so nice part) the installation process exits silently without further indication.
Event worse, using the same host account does not even generate an error because the application assumes that the host account (from the first installation) it is already existing, although you will not be able to login with this host account afterwards, as the machinecode of the second application server is different then the one on the first!
Solution
1. Step: Prefix host and admin name in DotNetNuke.install.config
Within the WebSite/Install folder I have prefixed the host and admin UserName as follows:
For the host account
<superuser>
…
<username>bsDev_host</username>
…
</superuser>
For the Admin account:
<portals>
<portal>
<portalname>Baron Solutions Website</portalname>
<administrator>
…
<username>bsDev_Admin</username>
…
</administrator>
…
</portal>
</portals>
2. Step: Prefix default roleMember UserIDs within Portal templates
Within the WebSite/Portal/_default folder I have adjusted the admin.template and the myOwnInstallation.template files as follows:
1. Have prefixed the default UserIDs in the <roles> node to “bsDev_” as follows:
<roles>
<role>
<rolename>bsDev_Admins</rolename>
…snip…
</role>
<role>
<rolename>bsDev_RegUsers</rolename>
…snip…
</role>
<role>
<rolename>bsDev_Subscribers</rolename>
…snip…
</role>
</roles>
2. Have prefixed all <rolename> nodes in all <permission> nodes (with exception of “All Users” as follows
<permission>
<permissioncode>SYSTEM_TAB</permissioncode>
<permissionkey>VIEW</permissionkey>
<rolename>bsDev_Admins</rolename>
<allowaccess>true</allowaccess>
</permission>
Pending Items:
Still not sure whether all this is just a bug or whether those security issues have been done on purpose.
When yes (done on purpose), I am not aware yet of the consequences of my corrections nor would I know about how to solve the problem otherwise and would be happy when someone could comment on this.