Migrating DotNetNuke From Development to Remote Production 

Recently I have been answering a large number of questions regarding the processes to deploy an existing development site from localhost to a remote hosting provider.  Typically this has been something that I was not willing to publish a tutorial on due to the complex nature of the matter and the major differences between hosting providers.  However, due to popular demand this article will be my first documentation of the end to end process to move a localhost DotNetNuke installation to a production environment on shared hosting.  I will be basing this article on the proceses that are needed to deploy to 3Essentials which is my hosting provider of choice, the process is similar for other hosts, but there may be charges or other complications introduced. 

Assumptions/Preface

Prior to starting the step-by-step process of migration I want to lay out the assumptions that are being made PRIOR to starting this process.  First and foremost you have a local installation of DotNetNuke installed on you machine.  This article assumes that you followed the process I set forth in my "Installing DotNetNuke 4.8.2 Locally" which used a SQL Server specific database and did not utilize the dynamic attachment feature.  If you used dynamic attachment or are using SQL Server 2000 your process will be different for the database preparation steps below.  Additionally prior to starting this deployment it is expected that you have a hosting account established with a hosting provider that supports ASP.NET 2.0, SQL Server 2005, and already have a domain name pointing to the account.  These setup/prerequisites are required to ensure a smooth transition from development to production.

This tutorial will be divided into multiple sections starting with DotNetNuke Preparation, Hosting Provider Preparation, DotNetNuke Migration, and wrapping up with Testing.  This will take you step by step through the process and will complete the tasks in an order to minimize the time to deploy and to minimize complication/confusion for those new to this process.

DotNetNuke Preparation

This step is one of the most commonly overlooked portions of the development to production process.  DotNetNuke uses portal aliases to determine which portal is associated with each respective incoming URL.  If a DNN site is moved to a new URL and a portal alias doesn't exist for the URL problems will be encountered.  Although possible to configure later, it is strongly advised to complete the portal alias addition prior to deployment as it makes the process that much smoother.  To add a portal alias you must login as the host user and then navigate to "Admin" -> "Site Settings".  On this page scroll to the bottom until you see this section.

Http Alias Listing

You will then click on the 'Add HTTP Alias' link to add an alias. Simply input the production URL in the textbox and click 'Add New Alias'

Add HTTP Alias

  be sure to enter just the domain name and no trailing forward slash as that will cause issues after the site is moved.  So for a site hosted on mysite.com the alias is simply mysite.com. Once yoou have completed this step you are now ready to prepare the hosting environment to accept DotNetNuke.

Preparing the Hosting Environment

As I mentioned before this tutorial is based on deploying to 3Essentials other providers might require different steps, or might have different processes for deployment.  The only host that I know that can cause a very large problem is GoDaddy as they do not support root installations.  If you have any questions about this section and your hosting provider please post to the forums on this site and I will do what I can to point you in the right direction.

Preparing the hosting environment is a step that is very important as it ensures that you will have a properly configured site going foward and minimizes the chances of errors appearing later on in the process.  I have divided this section into 2 separate steps as you have two distinct operations that you must validate

Validate ASP.NET Permissions

When you completed your local installation you went through the process to ensure that the ASP.NET worker process had proper permissions to your DNN installation, well the same thing is needed when moving the site to a hosting provider.  In the case of 3Essentials to fully validate the permissions you will need to submit a support request to have them modify the root file permissions.  Other hosting providers might provide permission tools, however, if using one of those be sure that you can modify the root permissions as well.  With 3Essentials You can simply submit the following request to support, obviously replacing mysite.com with your domain name.

Support,
Please modify the root file permissions for mysite.com to ensure that the ASP.NET
Worker process has full permissions to all files/folders for my DNN Installation.

I have worked with their support team enough to know that this is more than enough for them to get things up and going.

Validate ASP.NET Version

Another item that you must validate when depoying to a remote hosting provider is that the proper ASP.NET version is enabled for your installation.  For DotNetNuke 4.x you will need version 2.0.50727, for prior versions you will need 1.1.  Most hosting providers including 3Essentials allow you to validate this setting in your site settings.  With 3Essentials 2.0.50727 is the default version.

Configure Blank Database

In the next step of the process we will migrate your existing database to the hosting provider, however, before we can do this a new clean database must be created.  You can do this via the Plesk control panel provided by 3Essentials.  Simply go in an create a database (It does not have to have the same name) and then additionally create a new database user.  When creating the database user please be sure to use a DIFFERENT username than the one that was used on your local installation, this helps to avoid issues with orphaned user accounts.  Once complete be sure to remember the database name, username, and password of the items you created we will need these in later steps.

If you have problems with this step of the instructions please refer to your hosting providers support process.

Migrating DotNetNuke

Now that all preparation steps are out of the way we can actuall perform the migration of DotNetNuke.  I recommend doing this this in a 3 phase process which will be outlined below as this will help you ensure that all processes have been handled successfully.  Before continuing please ensure that ALL above listed steps have been completed as if any are not complete you can encounter errors.

Backup and Migrate Database

The first step in moving your DotNetNuke site is to move the database from your local system to the hosting provider.  The easiest method to complete this is to simply complete a SQL Server backup and then FTP this to your provider for restoring.  I will now walk you though this process using SQL Server Management Studio (Express).  If you are working with SQL Server 2005 this process will be slightly different.

With SQL Server Management Studio (SSMS) open right click on your DotNetNuke Database, in our case it is TestDNN, from the menu that appears select "Backup.." from the "Tasks" menu item.

SSMS Backup Option

Now you will be presented with a backup window. In this window take note of the backup location listed in the "Destination" section, then click "Ok" to complete the backup procedure.

SSMS Backup Window

Once this has been completed you will want to take the .bak file that was created and FTP it to your hosting provider.  With 3Essentials I like to place files such as this inside the /private folder in the FTP area as these files are NOT available any other way than FTP.  Once you have FTP'ed the file to the hosting provider you can then submit the following request to them for support.  Please replace [BACKUPFILE], [NEWDATABASE], and [DOMAIN] with the proper values for your installation.

Support,

I have just uploaded a SQL Server database backup file to the /Private/[BACKUPFILE] folder on my
FTP location.  Can you please take this SQL Server backup file and overwrite the [NEWDATABASE] 
that currently exists for my domain [DOMAIN].  This will allow me to migrate my DNN site
to your server.  Please delete the .bak file upon successful restore

This completes the first portion of the migration. You may proceed to the next step while your hosting provider performs the database restore.  I have found that I typically receive response from my provider within a few hours.

Migrate DotNetNuke Files

This step is the most simple of all DNN migration steps.  Simply FTP all files from your local DNN installation to your hosting providers site..  With 3Essentials the /httpdocs/ folder is your webroot, just be sure when uploading files that you are placing them in the proper location.  If you have your local installation in a sub folder (localhost/dnn) or something similar you do NOT have to keep that setup, however, until you look at my "notes" section at the end of the article you might have a few issues if removing a sub folder.

When loading the files to your remote host, be 100% sure that all files transfer successfully.  FTP programs commonly will encounter copy errors with such large file copies as a DNN installation and will not notify you of errors.  Therefore I highly recommend copying files one folder at a time to ensure that you get all files up successfully.

Modify Web.config Settings

This is the final step of your DotNetNuke migration, validating/modifying your web.config settings to point to the new database.   You cannot complete this step until all above steps have been completed, as completing this prior to the restoring of the database will cause issues when you go to test the site out in the next step.

Using the information that you obtained when preparing the hosting environment you will want to update your web.config file to point to your hosting provider's database.  I personally recommend doing this in the following manner.  Download a copy of the web.config from your FTP location.  Then open this file in Visual Studio and modify the connection information.  Remember you have 2 connection strings to modify and you want to make sure that both are now pointing to the proper database server and database.  Once you have the file updated, simply re-upload the modified file.

Following this process you are able to keep your local installation intact and still migrate to production.  Please note that if you have any questions on the proper formatting of the connection strings or the items to modify, please refer to my installation guides as they provide detailed information regarding the the connection strings.

Testing the Migration

If you have made it this far you have now completed the migration of your site.  You will now want to validate that everything is still functioning properly.  If you moved from a location with a sub folder to a root installation please see the "Missing Images?" section below for information on how to quickly resolve issues with missing images inside Text/HTML module instances. Below I will walk through a few common "breaking" points when migrating, this isn't an all inclusive listing but should cover most of the key items that are common.

Images Not Appearing

If you find that you have images that are not appearing that have been linked inside Text/HTML module instances and you migrated from an installation inside of a sub directory to a root installation you will need to modify the image links.  If for example you had your development site at http://localhost/dnn and your production site at http://www.mysite.com your image links inside the Text/HTML module would have a path of /dnn/portals...  you need them to be /portals to work successfully inside your production system.

Luckily I have an easy solution to resolve this issue.  My Text/HTML Replacement Tool that is available on this site will give you exactly what you need to fix the links.  Using this tool you can match on the following (without quotes) "/dnn/" and replace it with (again without quotes) "/".  This will resolve all borken links for instances of the sub-folder dnn being prefixed to image paths.  After using this tool you must remember that you must flush the application cache by clicking "Restart application" to see the changes.

Repository Files Not Downloading

If you receive file not found errors, or simply do not get files on repository module instances you will need to update the file path to the physical file store which is stored inside the settings for each respository listing.  If you are unsure of the proper file path, you can build the path using the base path information available via the "Host Settings" section of your site.

Conclusion

In conclusion I hope that this article has helped you migrate your development site to a production environment with a remote hosting provider.  This is a first revision of this tutorial so please share any feedback or comments that you have on this process and I will continue to upgrade this document as I do with my other tutorials.  If you have technical questions with an migration that you have performed please make a post in my forum for assistance.

Posted by Mitchel on Monday, May 19, 2008
 

Comments

This is a great article.
See http://www.mitchelsellers.com/Forums/tabid/123/forumid/2/tpage/1/view/topic/postid/1001/Default.aspx for some possibly helpful info on SQL security, roles, permissions etc. for the database ID used for your DNN database...
Thank you, Tom

By tlyczko on Monday, May 19, 2008 at 7:29 AM

I appreciate the step by step. I found your tutorial easy to follow and do. The error I received has me very confused though. It seems to be something that is in the dnn app_code global.asax.vb code that is misfiring at the start of the app. Can you suggest a possible fix?


Compiler Error Message: BC30451: Name 'Config' is not declared.

Source Error:



Line 66: ''' -----------------------------------------------------------------------------
Line 67: Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Line 68: If Config.GetSetting("ServerName") = "" Then
Line 69: ServerName = Server.MachineName
Line 70: Else


Source File: E:\web\heartoftexa\htdocs\DotNetNuke\App_Code\Global.asax.vb Line: 68

By Darnell on Thursday, May 22, 2008 at 6:26 PM

I would validate that ALL files copied successfully.

Once you have done that if you still have errors, please make a post in my forum and we will help get you fixed up!

By mitchel.sellers@gmail.com on Friday, May 23, 2008 at 5:33 AM

Hey.
I just migrated my DNN 4.8.3 from one server to another using your tutorial, but when I enter the new server's address, I get redirected to http://.../Install/UnderConstruction.htm and a message appears: "This site is currently Unavailable".

By Jay on Tuesday, July 15, 2008 at 11:57 PM

Jay,

Typically that will be due to an improper connection string to the new database.

I would start by validating the information supplied there.

By mitchel.sellers@gmail.com on Wednesday, July 16, 2008 at 3:58 AM

Mitchel,

Thank you for your generosity - sharing all this information. I really appreciate. I had the same error where my migrated site was coming up with the "Under Construction" message. It was indeed the database connection string.

Thanks!

By Will M. on Sunday, August 17, 2008 at 5:12 PM

Hi Mitchell,

Thanks for the information. I am going through this for the first time. I really want to set up the development and production installation in a way that one could go back and forth as desired. So, then, this method would entail changing the image paths in HTML everytime you copy installation from one side to the other. That would be a lot of work if you really stick to testing ALL your changes in the dev area and then wanted to uodate Production several times a day perhaps.

It seems to me the better solution would be to find a way to have both installs at the website root or both in folders under the web root. Since the problem is caused by having one install under the root and the other in a subfolder. No?

This desire of establishing Development and PRoduction areas is kind of a lot of work to manage. Particularly if your Production install is on a remote hosting server where one doesn't have all the admin permissions, one can't directly connect to SQL or restore SQL backups from other systems.

Well, we'll keep looking for better ways. I think maybe the DNN team can come up with a modification to handle this if enough peope need it.

Thanks for the help.

By Ivan Torres on Wednesday, September 17, 2008 at 4:21 AM

Ivan,

Yes, the simple solution is to have both installations on the root in IIS, if you do that, you will be fine.

By mitchel.sellers@gmail.com on Wednesday, September 17, 2008 at 4:54 AM

Hi,

I'm new to DotNetNuke and perhaps i'm a little biaised by my use to php portal where the migration is easier.

I have been trying to migrate a portal from one server to another one which should be easier than from a local server to a host.

I have backup and restore the database from on server to the other. I copied the dotnetnuke folder named "Intranet" from one server to the other.

I have had permissions issues taht i created on the folder and the new database.

I have had the corrected the connection string and the portal first page is displayed.

But every link I clicked, i get a "The page cannot be found" message.

I don't know what can be wrong. I seem to be a link tabid issue because the link is displayed but no page.

e.g. "http://applsvr/Intranet/LinkClick.aspx?link=55&tabid=36&mid=371"

By Terrence BELONY on Friday, October 03, 2008 at 1:58 AM

I meant "I have had permissions issues that i cleared on the folder and the new database."

and thanks for your help.

By Terrence BELONY on Friday, October 03, 2008 at 2:01 AM
Click here to post a comment

Donate

Show your appreciation for the content/modules made available by MitchelSellers.com by making a donation. Donations are used to assist with dedicating time to creating free content.