How to deploy Orchard CMS in Windows Azure? - deployment

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!

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.

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
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();
}
}
I had problems deploying with sites in /App_Data/ directory. Make sure that it is empty when you upload your package to Azure.
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.
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.
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.
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!

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

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

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.
You must find and include all projects where the app data folder is excluded
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.
Update the publishing settings of the folders required for app data and publish to copy always

Related

How to deploy an Office VSTO add-in using Visual Studio 2017

I've created an Outlook add-in, debugged and works fine. I want to be able to package it up for distribution. This is for a very limited audience 5-10 people. What are the steps to doing so?
I tried Build | Publish which appears to work (using options of local filename and CDROM install location), but creates a massive 1.5MB setup.exe file and when it is executed, takes forever (it appears trying to contact some remote server and times out and pops an error, although the add-in appears to be registered).
Looking online, I found references to creating a SetupProject or using InstallShield Limited addition, but none of those appear to apply to Visual Studio 2017.
I'd be happy if I could just provide my DLL and a .reg file -- this is for a small set of 5-10 power users.
What is the simplest way to deploy this add-in?
The easiest way is Build | Publish. Just disable any online activities if you don't want it. You can do that in Project -> Settings -> Publish. Check your "Updates" settings for example.
You can download a Visual Studio project type from here:
https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.MicrosoftVisualStudio2017InstallerProjects
This will allow you to deploy the package, but it's somewhat buggy in my opinion. Also, the link above does not have any documentation. You have to go to another page for that and the answer is buried in the comments:
https://msdn.microsoft.com/en-us/library/ybshs20f(v=vs.90).aspx
The ClickOnce has worked more consistently for us, however. Just right-click and select Publish on the Project.
It is a long ways off from the old InstallShield LE process, which allowed you to customize the entire process including images, click-through licensing, etc.
But the InstallShield LE had it's own set of issues, and seems to have been all but abandoned.
It may be worth looking at other 3rd-party tools like WiX (http://wixtoolset.org/) to get things installed correctly, or even manually writing your own installer to get things put where they need to be.

Why am I getting 404 /N2/Api/Context.ashx

I'm using the NuGet N2CMS package. I've tried version 2.9.6.8 and 2.9.6.14( and .16)
This is a fresh setup/install. When finishing the setup and navigating to /N2 I'm getting a 404 Not Found from the following:
/N2/API/Context.ash?mode=full
You can see my question on their GitHub here.
Anyone experience this, or have a fix?
bherila from the N2CMS team, was able to help me. It turns out that some of the Nuget Packages do not work out of the box; one of which is the standalone N2CMS package.
I was able to get a new project working using the N2CMS.NoZip (management UI) and N2CMS.MVC packages.
Even with these, you will still need to create and decorate a RootPage and StartPage to get past installation. You can see how I created those in the link I posted in my question

Visual Studio Online / Azure stopping and starting web applications using Powershell

I'm using Visual Studio Online's build tools to deploy web applications from a single solution. I've occasionally been running into file locking issues.
Error: Web Deploy cannot modify the file 'Microsoft.CodeAnalysis.CSharp.dll' on the destination because it is locked by an external process.
After some Googling, I believe the "fix" is to stop the web applications before deployment on Azure and start it back up after. Sounds legit.
However, there does not seem to be a straight forward way to do this directly on VSO's build definitions. I've created an "Azure Powershell" build task, but it wants a PS1 file from the repository. It doesn't seem to let me just run Azure Powershell commands (e.g. Stop-AzureWebsite) from here. My team has created a work-around where we have a "run.ps1" that just executes the command you pass as a parameter, but none of us are satisfied by that.
What are we missing? There has got to be an easier way to do this without having a PS1 script checked into source control.
I solved this by installing Azure App Services - Start and Stop extension from Visual Studio Marketplace.
When installed, it will allow you to wrap the Deploy Website to Azure task in your Release definition with Azure AppServices Stop and Azure AppServices Start tasks, effectively eliminating the lock issues.
Check if you are using "/" on the "Web Deploy Package" path for folder separators instead of "\".
i.e. change
$(System.DefaultWorkingDirectory)/My Project/drop/MyFolder/MyFile.zip
for
$(System.DefaultWorkingDirectory)\My Project\drop\MyFolder\MyFile.zip
I noticed that was the only difference between the one I was getting the error and the others (the Restart step I added was not helping). Once I modified the path, I got it working.
Sounds crappy, but fixed my issue.
Did you use the Build Deployment Template that sets the correct msbuild parameters for you for your package? You can see how here. I would create a build using that template and see if you have the same issues. If so ping me on Twitter #DonovanBrown and I will see if I can figure what is going on.
As a rule it is good practice to have any scripts or commands required to deploy your software to be checked into source control as part of your build. They can then be easily run repeatedly with little configuration at the build level. This provides consistency and transparency.
Even better is to have deployment scripts output as part of the build and use a Release Management tool to control the actual deployment.
Regardless having configuration as code is a mantra that all Dev and Ops teams should live by.

How do you deploy a website and database project using TFS 2010?

I've been trying to figure this out and so far haven't found a simple solution. Is it really that hard to deploy a database project (and a web site) using TFS 2010 as part of the build process?
I've found one example that involved lots of complicated checks and editing the workflow (which is a giant workflow btw).
I've even purchased the book "professional application lifecycle management with VS 2010", but apparently professionals don't deploy their applications since it isn't even mentioned in the book.
I know I'm retarded when it comes to TFS, but it seems like there should be any easy way to do this. Is there?
I can't speak for the database portion, but I just went through this on the web portion, the magic part is not very well documented component, namely the MSBuild Parameters.
In your build definition:
Process on the Left
Required > Items to Build > Configurations to Build
Edit, add a new one, for this example
Configuration: Dev (I cover how to create a configuration below)
Platform: Any CPU
Advanced > MSBuild Process
Use the following arguments (at least for me, your publish method may vary).
MsBuild Params:
/p:MSDeployServiceURL="http://myserver"
/p:MSDeployPublishMethod=RemoteAgent
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:username=aduser
/p:password=adpassword
Requirements:
You need to install the MS Deploy Remote Agent Service on the destination web server, MSDeploy needs to be on the Build/Deployer server as well, but this should be the case by default.
The account you use in the params above needs admin access, at least to IIS...I'm not sure what the minimum permission requirements are.
You configure which WebSite/Virtual Directory the site goes to in the Web project you're deploying. Personally I have a build configuration for each environment, this makes the builds very easy to handle and organize. For example we have Release, Debug and Dev (there are more but for this example that's it). Only the Web project has a Dev configuration.
To do this, right click the solution, Configuration Manager..., On the web project click the configuration drop down, click New.... Give it a name, "Dev" for this example, copy settings from debug or release, whatever matches closest to what your deployment server environment should be. Make sure "Create new solution configurations" is checked, it is by default. After creating this, change the configuration dropdown on the solution to the new Dev one, and Any CPU...make sure your projects are all correct, I had some flipping to x86 and x64 randomly, not sure of the exact cause of that).
In your web project, right click, properties. On the left, click Package/Publish Web (you'll also want to mess with the other Package/Publish SQL tab, but I can't speak to that). In the options on the right click Create deployment package as a zip file. The default location is fine, the next textbox I didn't find documented anywhere. The format is this: WebSite/Virtual Directory, so if you have a site called "BuildSite" in IIS with no virtual directory (app == site root), you would have BuildSite only in this box. If it was in a virtual directory, you might have Default Web Site/BuildVirtualDirectory.
After you set all that, make sure to check-in the solution and web project so the build server has the configuration changes you made, then kick off a build :)
If you have more questions, I recommend you watch this video by Vishal Joshi, specifically around 22 and 59 minutes in, he covers the database portion as well...but I have no actual experience trying it since we're on top of a non MSSQL database.

vb6 xcopy deployment

Can any one tell me how to convert an legacy application which is vb6 ( COM dll's ocx and exes) to use Regfree COM .
I tried opening the dlls in visual studio and created manifest file, but some of the dlls it is giving error.
Is there any tools out there which will help me to do this process?
I tried a tool from codeproject which is called regsvr42, which is not creating the manifest fully.
I used tools like PE explorer where I get all the typelib information , but converting them into manifest files is too difficult.
We have started migrating that to .NET, for some months we have to deploy it, it will easier if it is xcopy based deployment.
To create manifest files you can try to use Make My Manifest from http://mmm4vb6.atom5.com/.
EDIT The MMM website is down. I see here that the author was having trouble with their hosting and has provided another location to get Make My Manifest - download it here.
If you can control creation of objects you can use DirectCOM from http://www.thecommon.net/10.html
Keep in mind that if one of used DLLs or OCXs is creating other COM objects dynamically with CreateObject calls, that reference will not be stored in vbp project file and you won't get full manifest file. Probably you will have to catch object creations while the application is running. Depends.exe application can profile running application and report all used dlls. I don't know if there is tool that can find additional COM related information.
There is an excellent walkthrough of what to do in this article on MSDN: Registration-Free Activation of COM Components: A Walkthrough.
Make My Manifest can accomodate late binding as well as early binding. You simply have to add the references to the late-bound dependencies manually, by file location or by ProgId.
You might look at http://mmm4vb6.atom5.com/mmm-demo-1248.html for additional help in using the utility.
MakeMyManifest is well spoken of as an automatic tool for creating manifests for VB6 projects, haven't tried it myself.
DirectCOM also has fans, again I haven't tried it.
EDIT The MMM website is down. I see here that the author was having trouble with their hosting and has provided another location to get Make My Manifest - download it here.
There is a semi-automatic technique. You can create the manifests with Visual Studio 2008 (you can use a free version like Visual Basic Express Edition). Then make a couple of edits by hand to make the manifests suitable for use from VB6. See this section of this MSDN article for step-by-step instructions - ignore the rest of the article which is about ClickOnce.