How to deploy Orchard CMS in Windows Azure?
Asked Answered
D

5

6

Experts,

Is there any of you guys who has successfully built and deployed Orchard CMS (1.1 and above) in Azure?

I've tried to build the source codes (pulled from Codeplex repo) as suggested here: http://www.orchardproject.net/docs/Deploying-Orchard-to-Windows-Azure.ashx but keep on failing. If you see the comments of that article, you'll see some people are having the same problem with the ClickToBuildAzurePackage.cmd. It fails all the time!! It's not working at all!

Next, I downloaded the source codes package (Orchard.Web.1.2.41.zip) and tried to open the Orchard.Azure solution, build, and publish it (with remote desktop connection configured). I've also put in the correct DataConnectionString in the ServiceConfiguration.cscfg file before publishing it. It gave me a yellow screen of death with this message:

None of the constructors found with policy 'Autofac.Core.Activators.Reflection.BindingFlagsConstructorFinder'

Next, I tried to deploy the Azure package only (without source codes, Orchard.Azure.1.2.41.zip). This time, I could get the installation screen but then after setup was done, it gave me another yellow screen of death with several error messages that basically remind me to give proper permission for Media, Themes, Modules, and some other folders....How do I do that if I can't even setup the remote desktop connection for Azure as mentioned in the above?

I'm giving up on this...I start to think Orchard CMS (1.1 and above) is not ready for Azure. I could get the 1.0.2 version up and running in Azure (directly deployed the Azure-ready package, I didn't build the source codes).

Can anybody share their experience on this matter and the step-by-step guideline to get Orchard CMS (1.1 and above) running smoothly in Azure? May I know if we can also setup 2 instances in Azure for Orchard CMS? What are the things I need to consider / do to achieve that?

Thanks!

Demonolater answered 22/6, 2011 at 15:9 Comment(1)
I've successfully got Orchard 1.3 working on Azure with SDK1.6. Basic notes on here: programgood.net/2012/02/15/…Engird
N
1

I didn't get ClickToBuildToAcure.cmd script to work and that is why I wrote my own one, that Stuart helped linking to. My blog http://litemedia.info is running on Azure and those blog posts describes how I did it.

Some pointers

  1. My Global.asax.cs looks a bit different on Azure compared to running local.

    public class AzureApplication : HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        }
    
        protected void Application_Start()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher(
                (configName, configSetter) =>
                    configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
                );
    
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += (sender, e) =>
            {
                // If a configuration setting is changing
                if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
                {
                    // Set e.Cancel to true to restart this role instance
                    e.Cancel = true;
                }
            };
    
            RegisterRoutes(RouteTable.Routes);
            Starter.LaunchStartupThread(MvcSingletons);
        }
    
        protected void Application_BeginRequest()
        {
            Context.Items["originalHttpContext"] = Context;
            Starter.OnBeginRequest(Context, MvcSingletons);
        }
    
        protected void Application_EndRequest()
        {
            Starter.OnEndRequest();
        }
    
        static void MvcSingletons(ContainerBuilder builder)
        {
            builder.Register(ctx => RouteTable.Routes).SingleInstance();
            builder.Register(ctx => ModelBinders.Binders).SingleInstance();
            builder.Register(ctx => ViewEngines.Engines).SingleInstance();
        }
    }
    
  2. I had problems deploying with sites in /App_Data/ directory. Make sure that it is empty when you upload your package to Azure.

  3. You need to tell Autofac to use some Azure specific classes for settings and blog storage. You'll find these in /Config/Host.config and /Config/Sites.config. Go to my blog post above to see how I set them up.

  4. I spent several hours hunting down assemblies that was not copied to the Azure package. Make sure that all references are "Copy Local", even the MVC3 ones.

  5. Really make sure that you have the correct DataConnectionString setup in ServiceConfiguration.cscfg. I was banging my head against the wall for a long time because I had put a connection string for another account there.

  6. If you intend to deploy from a script you need to setup a certificate that will be used for the deployment. I used Visual Studio to create the certificate, and then only reference it from my script.

Good luck!

Newspaper answered 25/6, 2011 at 7:58 Comment(1)
Great explanation mate! I spent some time to solve #4 and I finally got it to work in Azure. I believe all of these processes need to be simplified at some point. Your blog post is really useful and that really helps me a lot. Thx!Demonolater
C
4

Since June 2012 there's also the possibility to easily host Orchard on Windows Azure Web Sites.

Here's an how to guide: How to setup Orchard CMS on Windows Azure Web Sites with a Windows Azure SQL Database.

This is an alternative approach which didn't exist at the time of the original question but might still be interesting for future readers who want to easily deploy Orchard CMS on Windows Azure.

Complainant answered 16/7, 2012 at 11:8 Comment(0)
T
1

I've not done this myself.

But I've read a few blog posts about deploying Orchard to Azure - e.g. see http://litemedia.info/automate-deploy-of-your-orchard-cms-to-azure - so I believe it can be done.

On the specific yellow screen of death issue - make sure you've used NuGet to resolve the AutoFac dependencies - see http://litemedia.info/deploy-orchard-cms-to-azure

Trilbi answered 22/6, 2011 at 16:45 Comment(0)
T
1

I've done that about a dozen times without a problem. About ClickTobuild, did you do that from a Visual Studio command prompt?

Terce answered 22/6, 2011 at 23:33 Comment(7)
Yes, I did it using Visual Studio 2010 command prompt (ran as administrator). Any suggestion how to build the package successfully using ClickTobuild? Is it possible to build the package directly using Visual Studio 2010?Demonolater
Ah, did you check that you have the 1.4 version of the Azure SDK? In my experience it's quite easy to get an older version without realizing it.Terce
Yes, I'm using the version 1.4. I tried to download and deploy the Azure-ready package and it worked fine in Azure. I wonder how you compile the source codes. I managed to get the ClickToBuild compiler to work by following as what @Trilbi suggested, which is resolving the dependency issue using NuGet package manager.Demonolater
The way I do it: I open a Visual Studio 2010 command prompt, cd to the directory where I cloned the source repo to the latest default branch, then run clicktobuildazure.cmd. That's it. After a few minutes of verbose compilation, I get a zip with the package and config to deploy. There has got to be somewhere you diverge from this but I can't spot it from your description, sorry.Terce
So i tried once again, exactly as what you suggested...I ran the console and I got this error: flickr.com/photos/62595469@N03/5865571250. Given the error, I updated the AzurePackage.proj and removed the test (line 27), ran the console again and it compiled successfully. I deployed to Azure, and I got this screen: flickr.com/photos/62595469@N03/5865074001.Demonolater
If you download the source code, and try to build directly using clicktobuildazure.cmd file, then everything should work. If it doesn't then please paste the real exception. It might help to understand the issue. I can give you lots of running instances on Azure, of any version of Orchard, so there must be a simple explanation to your issue.Steelworker
@Sebastien I built the source codes using clicktobuildazure.cmd and I got the errors as mentioned in my previous comments above (with the screen shots of the errors I got). Mikael's solution below helped me to get the issue solved.Demonolater
N
1

I didn't get ClickToBuildToAcure.cmd script to work and that is why I wrote my own one, that Stuart helped linking to. My blog http://litemedia.info is running on Azure and those blog posts describes how I did it.

Some pointers

  1. My Global.asax.cs looks a bit different on Azure compared to running local.

    public class AzureApplication : HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        }
    
        protected void Application_Start()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher(
                (configName, configSetter) =>
                    configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
                );
    
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += (sender, e) =>
            {
                // If a configuration setting is changing
                if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange))
                {
                    // Set e.Cancel to true to restart this role instance
                    e.Cancel = true;
                }
            };
    
            RegisterRoutes(RouteTable.Routes);
            Starter.LaunchStartupThread(MvcSingletons);
        }
    
        protected void Application_BeginRequest()
        {
            Context.Items["originalHttpContext"] = Context;
            Starter.OnBeginRequest(Context, MvcSingletons);
        }
    
        protected void Application_EndRequest()
        {
            Starter.OnEndRequest();
        }
    
        static void MvcSingletons(ContainerBuilder builder)
        {
            builder.Register(ctx => RouteTable.Routes).SingleInstance();
            builder.Register(ctx => ModelBinders.Binders).SingleInstance();
            builder.Register(ctx => ViewEngines.Engines).SingleInstance();
        }
    }
    
  2. I had problems deploying with sites in /App_Data/ directory. Make sure that it is empty when you upload your package to Azure.

  3. You need to tell Autofac to use some Azure specific classes for settings and blog storage. You'll find these in /Config/Host.config and /Config/Sites.config. Go to my blog post above to see how I set them up.

  4. I spent several hours hunting down assemblies that was not copied to the Azure package. Make sure that all references are "Copy Local", even the MVC3 ones.

  5. Really make sure that you have the correct DataConnectionString setup in ServiceConfiguration.cscfg. I was banging my head against the wall for a long time because I had put a connection string for another account there.

  6. If you intend to deploy from a script you need to setup a certificate that will be used for the deployment. I used Visual Studio to create the certificate, and then only reference it from my script.

Good luck!

Newspaper answered 25/6, 2011 at 7:58 Comment(1)
Great explanation mate! I spent some time to solve #4 and I finally got it to work in Azure. I believe all of these processes need to be simplified at some point. Your blog post is really useful and that really helps me a lot. Thx!Demonolater
R
0

I have the orchard core project from https://github.com/OrchardCMS/OrchardCore. Then I ran into a few issues while adding azure devopsa. In order to offer you a solution proposal.

  1. You must find and include all projects where the app data folder is excluded
  2. You should not forget to add web config to your project Note: If you are suspicious of the web config you added, you can try to run the project in local iis.
  3. Update the publishing settings of the folders required for app data and publish to copy always
Romish answered 20/12, 2022 at 11:56 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Waylonwayman

© 2022 - 2024 — McMap. All rights reserved.