Showing posts with label Sitecore. Show all posts
Showing posts with label Sitecore. Show all posts

20110210

Deploying Sitecore CMS to Windows Azure using VM Role

Sitecore CMS can be deployed to Microsoft Azure using Sitecore CMS Azure Edition, but as a proof of concept I gave it a try to upload it using Virtual Machine (VM) Role.

Using exactly same procedure as with EPiServer you can deploy Sitecore CMS. Only change required was updating aspnet_Membership_GetNumberOfUsersOnline procedure as in original it's not compatible with Azure SQL. So after database migration additional query with code placed below is required:

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER OFF
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aspnet_Membership_GetNumberOfUsersOnline]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE dbo.aspnet_Membership_GetNumberOfUsersOnline
    @ApplicationName            nvarchar(256),
    @MinutesSinceLastInActive   int,
    @CurrentTimeUtc             datetime
AS
BEGIN
    DECLARE @DateActive datetime
    SELECT  @DateActive = DATEADD(minute,  -(@MinutesSinceLastInActive), @CurrentTimeUtc)

    DECLARE @NumOnline int
    SELECT  @NumOnline = COUNT(*)
    FROM    dbo.aspnet_Users u WITH (NOLOCK),
            dbo.aspnet_Applications a WITH (NOLOCK),
            dbo.aspnet_Membership m WITH (NOLOCK)
    WHERE   u.ApplicationId = a.ApplicationId                  AND
            LastActivityDate > @DateActive                     AND
            a.LoweredApplicationName = LOWER(@ApplicationName) AND
            u.UserId = m.UserId
    RETURN(@NumOnline)
END' 
END