Deploying MVC applications

Using staging for the content of MVC applications

You can use Staging to transfer page content and other objects, which were created in the administration UI, between different instances of Kentico, even when using a separate MVC application for the presentation of the website.

For MVC websites, every "instance" within the staging topology must consist of the following components:

  • The Kentico application used to store data and manage content
  • The MVC application used to generate the design of the live website (or multiple MVC applications running in a web farm)
  • One Kentico database shared by the applications

The steps required to set up the staging are the same as with standard Kentico projects. You need to configure the staging between the Kentico applications, which then provide the transfer of data between the databases of the given staging instances. The MVC applications within individual staging instances use the data of the related Kentico application to present the website.

On this page

Running MVC applications on Microsoft Azure

You can run your MVC application, together with the Kentico application, on Microsoft Azure. You can make use of either Azure Web Apps or Azure Cloud Services.

Running MVC applications on Azure Web Apps

  1. Perform the initial set up of your MVC application.
  2. Deploy the Kentico database to Azure.
  3. Deploy the Kentico application and MVC application to Azure Web Apps. Perform the following tasks for both applications:
    1. Create Azure Web Apps service from Visual Studio.

    2. Deploy the project to Azure Web Apps.

  4. Edit () your site in Kentico and add a domain alias and presentation URL for your MVC application.

Running MVC applications on Azure Cloud Services

Configuring the Kentico application project

  1. Deploy the Kentico application to Azure Cloud Services:
    1. Prepare the cloud environment.
    2. Install Kentico as an Azure project.
    3. Configure the Azure project.
    4. Deploy the project to Cloud Services.
    5. Install the database for your project.

  2. Once deployed, edit () your site and add a domain alias and presentation URL for your MVC application.

The Kentico application now runs on Azure Cloud Services. You can continue to configure your MVC application.

Configuring the MVC application project

Prepare your MVC application:

  1. Perform the initial set up of your MVC application.
  2. Open the MVC solution in Visual Studio.
  3. Build your solution.
  4. In the toolbar of Solution Explorer, click Show All Files.
  5. Right-click the following folders and select Include In Project:
    • CMSDependencies
    • CMSResources
  6. In the properties of all resx files in the CMSResources folder, set the Build Action property to Content.
    Setting the property value to Content tells the publishing process to copy the file as-is to the destination.

Configure the Azure Cloud Service project for deployment in your MVC application:

  1. Add an Azure Cloud Service project to your solution:
    1. In Visual Studio, right-click the MVC solution and select Add -> New project...
    2. Select a supported .NET Framework version (i.e., 4.5, 4.5.1, or 4.5.2).
    3. In the Add New Project dialog, select Azure Cloud Service and click OK.
    4. In the New Microsoft Azure Cloud Service dialog, double-click ASP.NET Web Role to add it to a list of Microsoft Azure Cloud services and click OK.
    5. In the New ASP.NET Project window, click Cancel (do not choose a template).

  2. Add a Web Role Project to the Azure Cloud Service:
    1. In the Azure Cloud Service project, right-click Roles and select Add -> Web Role Project in solution.
    2. In the Associate with Role Project dialog, select your MVC application project and click OK.

  3. Copy the role settings from the Kentico Azure project's CMSApp role to the MVC application project's new web role:
    1. In both Kentico and MVC solutions, open the Properties of their Web Role Projects.
    2. Switch to the Settings tab.
    3. Set Service Configuration to All Configurations.
    4. Click Add Setting and copy the Name and Value of a setting from one role to the other.
    5. Repeat the previous step for all settings.
    6. Save the changes.

  4. Right-click the Azure Cloud Service project and select Publish...
    1. On the Settings tab, use the same Storage account that you are using for the Kentico application.
    2. Click Next.
    3. Verify the configuration in the Summary.
    4. Click Publish.

Was this page helpful?