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:

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:

SELECT 'dbo.' + [name]
FROM sysobjects
WHERE xtype = 'u'

OPEN tabcurs
FETCH NEXT FROM tabcurs INTO @tname

WHILE @@fetch_status = 0

EXEC sp_changeobjectowner @tname, 'charity'

FETCH NEXT FROM tabcurs INTO @tname
CLOSE 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. You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing.