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.
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
Perform the initial set up of your MVC application.
Deploy the Kentico application and MVC application to Azure Web Apps. Perform the following tasks for both applications:
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
Deploy the Kentico application to Azure Cloud Services:
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:
Perform the initial set up of your MVC application.
Open the MVC solution in Visual Studio.
Build your solution.
In the toolbar of Solution Explorer, click Show All Files.
Right-click the following folders and select Include In Project:
- CMSDependencies
- CMSResources
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:
Add an Azure Cloud Service project to your solution:
- In Visual Studio, right-click the MVC solution and select Add->New project…
- Select a supported .NET Frameworkversion (i.e., 4.5, 4.5.1, or 4.5.2).
- In the Add New Project dialog, select Azure Cloud Service and click OK.
- In the New Microsoft Azure Cloud Service dialog, double-clickASP.NET Web Role to add it to a list of Microsoft Azure Cloud services and click OK.
- In the New ASP.NET Project window, click Cancel(do not choose a template).
Add a Web Role Project to the Azure Cloud Service:
- In the Azure Cloud Service project, right-click Roles and selectAdd ->Web Role Project in solution.
- In the Associate with Role Project dialog, select your MVC application project and click OK.
Copy the role settings from the Kentico Azure project’s CMSApp role to the MVC application project’s new web role:
- In both Kentico and MVC solutions, open the Properties of their Web Role Projects.
- Switch to the Settings tab.
- Set Service Configuration to All Configurations.
- Click Add Setting and copy the Name and Value of a setting from one role to the other.
- Repeat the previous step for all settings.
- Save the changes.
Right-click the Azure Cloud Service project and select Publish…
- On the Settings tab, use the same Storage account that you are using for the Kentico application.
- Click Next.
- Verify the configuration in the Summary.
- ClickPublish.