Saturday, July 23, 2011

Deploying Sitefinity v. 4.x to a shared hosting provider

Unfortunately, due to the nature of deploying to a shared hosting provider, you have to alter the schema associated with the database in order to get Sitefinity to work.  For example, if you are developing on your local machine using 'sa' or similar 'dbo' privileges, when you finally deploy a backup of your development database to your shared hosting provider, you will have to create an associated username/password that will be associated with that particular database.

In those instances, since the 'dbo' schema will no longer be accessible, you will have to alter the name prefix of the database schema from 'dbo' to the user name you created in your shared hosting provider configuration.

Details about how to accomplish this can be found here:
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/bugs-issues/error-invalid-root-node-configured-for-pages-no-root-node-with-the-name-of-quot-frontendsitemap-quot.aspx


In addition, some shared hosting providers provide support for Full Trust, but the hosting providers by default run in "Medium Trust".  Therefore, it is necessary to add the <trust level="Full" /> element to the Web.config file in order to get the ASP.Net Web Site to run under Full Trust (as is required by Sitefinity v. 4.x)

The database script to rename the associated database schema can be found below:


DECLARE tabcurs CURSOR
FOR
SELECT 'dbo.' + [name]
FROM sysobjects
WHERE xtype = 'u'

OPEN tabcurs
DECLARE @tname NVARCHAR(517)
FETCH NEXT FROM tabcurs INTO @tname

WHILE @@fetch_status = 0
BEGIN

EXEC sp_changeobjectowner @tname, 'charity'

FETCH NEXT FROM tabcurs INTO @tname
END
CLOSE tabcurs
DEALLOCATE tabcurs

NOTE: You should run this script to change the database owner prior to actually accessing the website for the first time in Sitefinity. If you access the website through Sitefinity first, Sitefinity will attempt to create the necessary database objects for you, thus resulting in potentially duplicate table creation.

1 comment:

  1. Best web hosting companies. Reviews, rates, statistics of top hosting companies.
    Find best hosting company at www.HostingCompaniesz.com

    ReplyDelete