Loading...
Area: Episerver Customer-Centric DXP
Applies to versions: Not applicable

Creating a new CMS site and deploying

This topic describes a deployment onboarding scenario where you create a new website based on the Episerver Alloy sample site, and deploy the application, database and content to the Integration environment in Episerver Customer-Centric Digital Experience Platform (DXP).

When is this applicable?
This is an onboarding scenario for a first-time/onboarding deployment of a new site based on the Episerver sample templates, to use from start for development in a cloud environment. Through Visual Studio, you can deploy an empty database. A new site like this does not require database restore, and the database schema is created during initial deployment.

Before you start

This example uses Visual Studio (2019) with the Episerver extensions and publish profiles, but you can also use other deployment methods.

  • See Requirements for recommended versions of software, tools and services to use when deploying.
  • See Getting started with DXP for information needed to deploy.
  • See Installing Episerver how to add the Episerver NuGet feed to Visual Studio.
  • Update the Azure SDK to the latest version for your Visual Studio installation.
  • Before deploying, add a wildcard binding to the site in the Manage Websites screen. This will help prevent failures due to URL dependent code when migrating the database between environments. See the following image, which shows an example of this binding.
    1. Select Admin > Config > Manage Websites.
    2. Click Add and add a wildcard (*) Host Name.

      wildcard binding.png

Deployment steps

The following steps create a new website, add Azure and Find, and deploy the code and database with content to the Integration environment in DXP. The deployment is done from Visual Studio, using the publishing profiles provided by Episerver with your DXP setup.

Note: Episerver has a bootstrap feature for deploying content. If there is an export package located in [SolutionDir]\App_Data\DefaultSiteContent.episerverdata, that package is imported during initialization and a site with content is created. The bootstrap is applied only if the site in the web app does not have any existing content.

STEP 1. Create a website with Azure

  1. In Visual Studio, click Create a new project.
  2. Search for Episerver, select Epierver Web site, and click Next.
  3. In the Configuration dialog box:
    1. Enter Project name.
    2. Enter Location.
    3. Enter Solution name
    4. Select your Framework (this example uses .Net Framework 4.7.2).
    5. Click Create.
      Configure-project.png
  4. In the Template dialog box:
    1. Select Alloy (MVC or Web Forms).
    2. Clear the Configure Search option. Episerver Search and Navigation (formerly Episerver Find) is added in a later step.
    3. Click OK.
          Select-template.png 
  5. Select Tools > NuGet Package Manager > Manage NuGet Packages for Solution to update the website to the latest Episerver NuGet packages.
  6. In the NuGet Package manager:
    1. Select Updates.
    2. Select Episerver Packages in the Package source field to locate the latest updates.
    3. Enable Select all packages.
    4. Click Update and confirm the updates.
      Update-packages.png
  7. Add Azure to the website. In the NuGet package manager:
    1. Select Browse.
    2. Enter Episerver Azure in the search field.
    3. Select the EPiServer.Azure package.
    4. Select your project.
    5. Click Install and confirm the installation.
        Add-Azure-package-to-VS.png
  8. Select Tools > NuGet Package Manager > Package Manager Console.
  9. Enter update-epidatabase at the Package Manager prompt (PM> ).
  10. Run the solution.
  11. Follow the instructions to update the database and add admin account (if needed) and click Register. The Alloy site appears.
    Create-admin-account.png

STEP 2. Update the configuration

You need to change some configurations for the website to work with Azure. The container attribute for the BLOB provider and topic for the event provider should be unique per site, within the same storage or service bus account. Therefore you need to update the mapping for BLOBs and event providers.

Important! Do not skip this step! If you do, assets are stored locally, and will not deploy properly to the Azure BLOB storage.

  1. In Visual Studio, open web.config and add the following configuration under the episerver.framework section.
    Do not change the values for connectionStringName, because these are overwritten with the correct environment-specific values during deployment. Optionally, you can change the container and topic names mysitemedia and MySiteEvents to names of your choice. The storage container name must be in lowercase, for example mysitemedia, for DNS compatibility.
    <blob defaultProvider="azureblobs">
      <providers>
        <add name="azureblobs" type="EPiServer.Azure.Blobs.AzureBlobProvider,EPiServer.Azure"
          connectionStringName="EPiServerAzureBlobs" container="mysitemedia"/>
      </providers>
    </blob>
    <event defaultProvider="azureevents">
      <providers>
        <add name="azureevents" type="EPiServer.Azure.Events.AzureEventProvider,EPiServer.Azure"
          connectionStringName="EPiServerAzureEvents" topic="MySiteEvents"/>
      </providers>
    </event>
  2. Compile the solution (Build > Build Solution) and run it.

    Note: Your local site displays an error message because the site is pointing to Azure after the configuration changes. This is corrected when you publish the project to Azure.

Note: When you deploy a website, you may want settings in the deployed application's web.config to be different from your local development web.config. Instead of changing these settings for your local installation (as done here), you can apply a transformation of the web.config file when you deploy to Azure to avoid breaking your local site.

STEP 3. Publish website with content

  1. In Solution Explorer, right-click the project in Visual Studio and select Publish.
  2. In the Pick a publish target dialog box, select App Service and Select Existing, then select Create Profile > Publish immediately; the App Service dialog box appears.

    Select-existing-app-service.png

  3. Click Create.

    Create-new-app-service.png

  4. Under Publish, click Edit.

    Publish-edit.png

  5. Connection should display the imported publish profile settings, no changes are required here. Click Next.

    Publish-connection.png

  6. In the Settings section, enter the remote connection string to SQL Database by selecting it under EPiServerDB (copy/paste it from the publish profile if it does not appear in the list).

    Publish-settings-filled.png

  7. Enable Update database, and click Configure database updates

    Note: If this is not the first time you are publishing to the Azure web app (for example, you are republishing), disable this option because there are already database objects created.

  8. Clear the [Auto schema update] option, click Add SQL Script, and browse to the EPiServer.CMS.Core NuGet packages (located in [SolutionDir]\packages\EPServer.CMS.Core.N.N.N\tools\), and select EPiServer.Cms.Core.sql.

    Select-sql-database.png

    Publish-settings.png

  9. Click Save in the Settings section.
  10. Click Publish to publish the website with content. The website opens in a browser when finalized. If not, you can access it with the default URL for the environment, publishing profiles provided by Episerver with your DXP setup.

STEP 4. Verify the website

  1. Go to the default access URLs for the environment, for example http://[projectNNNNinte].dxcloud.episerver.net
  2. Log in to the website with the administrator user (see below).
  3. Verify that the website is working.

Add an administrator account

During creation of an Alloy sample site, you are prompted to add an admin account. However, these credentials are stored in your local database, and are not deployed to the web app. Therefore, you may need to create a new admin user, to log in after deployment.

If you do not have an admin account, you can create and upload an .aspx file to your web app, and let it create an account. See these example files for ASP.NET Membership and ASP.NET Identity. Select the appropriate one depending on your provider (ASP.NET Identity for an Alloy sample site). Follow the instructions in the file. Use Kudu to upload the file to the website root folder, and open the file once in a browser. Log in by adding /episerver to the site URL, using the credentials in the uploaded file.

Note: When you have succesfully logged in, remove the .aspx file from the site in the web app.

STEP 5. Add Search and Navigation (formerly Find)

A Find index is automatically set up and configured as part of DXP. In this step, you add Episerver Search and Navigation as default search for your solution, and publish the changes to Integration.

  1. In the NuGet package manager for your project, locate the EPiServer.Find.Cms package and click Install.

    Add-find.png

  2. In web.config, modify <episerver.framework> to <episerver.framework createDatabaseSchema="true">.
  3. In Solution Explorer, right-click the project in Visual Studio and select Publish. (In the Edit > Publish > Settings screen, ensure that Update database is not selected (deselect if needed).)
  4. Click Publish.
  5. Verify that the website is working.

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Apr 02, 2020