Deploying MVC sites

After you finish development of a Kentico website, you typically need to deploy the site to a remote hosting server (production environment).

You can use the following process for the initial deployment:

  1. Transfer your web project files from your local environment to the hosting server. You need to deploy both your MVC live site project and Kentico administration project.

    Tip: There are several possible ways of deploying the project files, including copying over FTP or using the Visual Studio Publish function (with optional precompilation).

  2. Ensure that both applications are registered and configured correctly in the hosting server's IIS. See also: Manually configuring Kentico applications in IIS
  3. Deploy your Kentico database. You can choose between the following approaches:
    • Restore a database backup on your hosting SQL server, and manually update the connection string in the web.config file of both projects.
      – OR –
    • Install a new database on your hosting SQL server and use the Kentico Export/import feature to transfer the site:
      1. Delete the connection string from the web.config file of the deployed Kentico administration project.
      2. Open the Sites application on your local development instance and click Export site () next to the site that you want to deploy.
      3. Enter the name of the export package and go through the Site export wizard.
        • The system saves the export package into the <web project>\CMS\CMSSiteUtils\Export folder.
      4. Copy the exported package into the <web project>\CMS\CMSSiteUtils\Import folder on the hosting server.
      5. Open the administration interface of the deployed administration project in a browser.
      6. Create a new Kentico database on your hosting SQL server.
      7. At the end of the Database installation wizard, choose to import your existing site (from the previously exported package).
      8. Copy the new connection string from the web.config of the deployed administration project into the web.config of your MVC project.

You may also need to adjust the site's settings for your production environment:

  • Open the Sites application. Edit the site and make sure the domain, presentation URL, and any domain aliases are configured correctly for the production domains.
  • Open the Settings application and make sure your site settings contain correct values. For example, the SMTP server setting in the System -> Emails category (you may use a different SMTP server in your production environment).

Your site is now deployed. You can maintain the site and update its content by setting up staging or by manually deploying newer import packages.

Running MVC websites on Microsoft Azure

You can run both your MVC application and the related Kentico administration application on Microsoft Azure.

The recommended approach is to deploy the applications to Azure Web Apps:

  1. Deploy the Kentico database to Azure.
  2. Prepare two different Azure App Service hosting plans – one for the MVC application and another for the administration application.

    A setup with two different hosting plans is recommended, because it allows you to scale the applications independently. In most cases, the MVC live site will receive the bulk of the traffic and have different performance requirements than the administration interface.

  3. Deploy the Kentico administration application and MVC application to Azure Web Apps. Perform the following tasks for both applications:
    1. Create an Azure Web App service from Visual Studio.

    2. Deploy the project to Azure Web Apps.

  4. Make sure both applications are configured to use the same server time zone. See Changing the server time zone on Azure Web Apps.

See also: Hosting Kentico MVC Applications in Azure

Was this page helpful?