Introduction

This post is meant as a simple proof-of-concept and basic primer into XCOPY deployment with EPiServer CMS 7.5. 

It covers the basic configuration steps you need to go through on a blank Windows Server 2012/Azure Virtual Machines environment.
It does not cover advanced deployment (e.g. via Visual Studio or Team City), nor deployment to Azure Websites environments, as these topics are well covered in other blogs.

The TL;DR version:
- Prerequisite features are .NET framework, IIS and SQL Server only.
- Restore your db, copy your application files and you're done.
- No installation of EPiServer Deployment Center necessary.
- No dependencies on GAC or Windows services.


Why XCOPY deployment matters


The term "XCOPY" is not new - originally it means copying an entire directory structure from one location to another location.
In EPiServer context, XCOPY deployment means being able to copy an entire functional site - application files, media, database and even the EPiServer CMS Shell/UI - to another server, without having to install anything on the server beforehand.

NOTE:
 Fundamental features like .NET framework, IIS and SQL Server are still required. 

That's possible because EPiServer sites**  no longer have any external system dependencies, everything is self-contained within your web site.
No EPiServer assemblies cluttering up the GAC, no dependency on the Windows Scheduler Service for scheduled jobs, no references to %PROGRAM FILES% or other server-specific paths in config files, etc. 

NOTE:
 XCOPY deployment is currently only fully supported for CMS sites. EPiServer Commerce and Relate still have some external dependencies.

For sysadmins and developers, this means less time spent setting up and maintaining website environments.

 

Deploying to Azure environments


XCOPY deployment is especially useful in Cloud environments like Azure, where you often don't have sufficient permissions to install any applications or services on the system. Now that EPiServer CMS 7.5 has no external system dependencies, that won't be a problem.
For the record, Azure basically comes in two flavors:
  • "Azure Virtual Machines" - where you basically get full control over a virtual Windows Server. You are allowed to play virtual sysadmin and install programs/services, partition your disks, setup Remote Desktop access etc - without having to worry about hardware or scaling. 
    For database needs, you can install SQL Server directly on the server if you wish. 
  • "Azure Websites" - where you have practically no control over the server environment, you're not allowed to install anything, you just get an empty folder to drop your web application into (typically via Azure Management Portal).
    For database needs, you would use the Azure SQL Server feature, which is a virtual, Cloud hosted SQL Server instance (Database-as-a-Service) to drop your database into.
NOTE: While CMS 7.5 now officially supports running on the Azure Websites variant, getting all of EPiServer's features to work requires a bit of extra configuration, and in some cases, a few unofficial workarounds.

 

 

Configuring basic features


I'm starting with a clean install of Windows Server 2012 R2 Datacenter as typically provided by a hosting partner.
It's being hosted as an Azure Virtual Machine, but it's really just like any virtual or physical Windows Server you're used to working with.

NOTE: Often, these basic features are already configured by your hosting partner. 


.NET framework

First thing we'll do is install the .NET framework. In my case the project is targeting .NET 4.0, but go ahead and install whatever framework version your project requires.


IIS 8 features

On a clean Windows Server 2012 install, IIS is not activated by default.
If you ever have to send instructions to a hosting partner (or do it yourself), this overview will come in handy.

Open Control Panel > Turn Windows features on or off. This will open the Add Roles or Features wizard.

In the Server Roles section, check the following boxes:

IIS Server roles wizard

In the Features section, check the following boxes:
IIS features wizard

You may need to reboot your server to complete the installation.


SQL Server

If you don't have physical access to the server (to install from DVD) you'll most likely install from an ISO image or a web installer (if you're using SQL Server Express).
Installation is straight-forward, just remember to enable "Mixed mode authentication" if you need to authenticate both Windows and SQL created users.

After installation, restore (or attach) the database you copied from your other environment and make sure there is a valid login to put in your connectionstring config.


Deploying application files


NOTE: While EPiServer Deployment Center will to a lot of the basic tasks for you (create a database, setup the website in IIS and set user permissions to your AppData and Web folders, it is not necessary. To illustrate that we can get the site up and running without Deployment Center, we'll perform these tasks manually.

For simplicity, the folder I'm deploying to will look something like this:
  • D:\EPiServer\Sites\MySite\AppData\  (will contain all media, index, modules etc)
  • D:\EPiServer\Sites\MySite\Web\  (will contain all application files, EPiServer CMS/Shell, license etc)
After deploying your files to their respective folders, open up IIS and Add Website.
Make sure the physical path of the site points to your Web folder.
Bind your site to an appropriate host name and port number.

If you want to browse the site locally using its host name, add the host header to your C:\Windows\System32\Drivers\etc\hosts file.

Make sure all your .config files (web.config, episerver.config, episerverframework.config) reference the correct path to your folders, and the correct URL to your website.
(This is normally handled with config transformations via your build server.) 
 

User permissions

If your site is running with the default AppPool, you need to make sure the built-in IIS_IUSRS account has read+modify access to both your AppData and Web folders.


Manage site settings

By now, you should have a functional web site that you can log onto. 
There's one more bit of config to be done - managing the website settings in Admin mode. Previously this was done via <siteSettings> in episerver.config, but this is now available in the database only (through the Admin UI).

Log into EPiServer and goto Admin mode > Config tab > Manage websites.
Add your website and the hostname you gave it in IIS. 
Add any language versions you want the site to respond to. 


Done!


What have we achieved through this little exercise?
  • We copied a functional site onto another server, keeping the website, appdata and database structures intact
  • Aside from some basic IIS bindings, all necessary config is included with the site
  • We avoided installing proprietary software (e.g. Deployment Center) onto the server
  • There are no EPiServer assemblies installed in the GAC
  • There are no EPiServer services installed, nor is the site dependent on any Windows Services on the server