I have been trying to upgrade my 4.9.4 site to 5.1.4 for about a week without success so in order to get to the bottom of the problem I downloaded the source for the new 5.1.4 and replaced the website in the solution with mine(after copying the 5.1.4 install package over it) and changed all the compiler setting to produce debug output and target my sites bin directory. Here is what I found: during upgrade a stack overflow exception was being thrown from the install.aspx.vb file at the line "Services.Upgrade.Upgrade.UpgradeDNN(strProviderPath, DataProvider.Instance().GetVersion)" after stepping through in the debugger I found that the DataProvider.Instance() was returning the wrong provider instance so the GetVersion failed this triggered exception handling code which attempts to log the exception to the database and those calls access the wrong DataProvider and generated further exceptions in a never ending loop thus the stack overflow. Now the problem is stemed from the fact that my webconfig file in not the same as the vanilla install. I have developed some of my own modules and two of them access data from other databases so after reading Shaun Walkers "DotNetNuke Data Access" paper I concluded that I could add my databases to the appropreate section in the webconfig like this:
<connectionStrings>
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient" />
<add name="GriffinSqlServer" connectionString="Data Source=HAL9000\GRIFFINSQL;Database=GriffinContacts;uid=INTERNAL\jfeyes;pwd=xxxxxxx;" providerName="System.Data.SqlClient" />
<add name="ProjectSqlServer" connectionString="Data Source=CRAYII;Database=ProjectServer_Reporting;uid=DNN;pwd=xxxxxxx;" providerName="System.Data.SqlClient" />
</connectionStrings>
......
<data defaultProvider="SqlDataProvider">
<providers>
<clear />
<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo" />
<add name="GriffinDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="GriffinSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo" />
<add name="ProjectDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="ProjectSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo" />
</providers>
</data>
And it worked fine from the time I wrote the modules back in version 4.0 all the way through to version 4.9.4 and I never once encountered a problem upgrading. But now for some reason the core seems to not be picking up the defaultProvider and grabbing the second entry from the data/providers section. So is there something not right in the core?
Anyway to remidy the problem I created new provider types in the webconfig like this:
<configuration>
<!-- register local configuration handlers -->
<configSections>
<sectionGroup name="dotnetnuke">
<!-- the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support-->
<section name="data" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
<section name="projectdata" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
<section name="contactdata" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
Then made seperate provider entries for those types like this:
<data defaultProvider="SqlDataProvider">
<providers>
<clear />
<add name="SqlDataProvider"
type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider"
connectionStringName="SiteSqlServer"
upgradeConnectionString=""
providerPath="~\Providers\DataProviders\SqlDataProvider\"
objectQualifier=""
databaseOwner="dbo" />
</providers>
</data>
<projectdata defaultProvider="ProjectDataProvider">
<providers>
<clear />
<add name="ProjectDataProvider"
type="GriffinAutomation.Modules.Griffin_Projects.SqlDataProvider, GriffinAutomation.Modules.Griffin_Projects"
connectionStringName="ProjectSqlServer"
upgradeConnectionString=""
providerPath=""
objectQualifier=""
databaseOwner="dbo"/>
</providers>
</projectdata>
<contactdata defaultProvider="GriffinDataProvider">
<providers>
<clear />
<add name="GriffinDataProvider"
type="GriffinAutomation.Modules.Griffin_BCM.SqlDataProvider, GriffinAutomation.Modules.Griffin_BCM"
connectionStringName="GriffinSqlServer"
upgradeConnectionString=""
providerPath=""
objectQualifier=""
databaseOwner="dbo"/>
</providers>
</contactdata>
Now in the data access layer code for the module one change is needed to reference the new type instead of "data" like this:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Framework.Providers
Namespace GriffinAutomation.Modules.Griffin_Projects
''' -----------------------------------------------------------------------------
''' <summary>
''' SQL Server implementation of the abstract DataProvider class
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Public Class SqlDataProvider
Inherits DataProvider
Private Const ProviderType As String = "projectdata"
Private Const ModuleQualifier As String = ""
Private _providerConfiguration As ProviderConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType)
Private _connectionString As String
Private _providerPath As String
Private _objectQualifier As String
Private _databaseOwner As String
After these changes everything seems ok. But the question remains, Why did 5.1.4 break with my webconfig setup? somthings not right.