MVC setup in Kentico
Usually, even a seemingly unrelated problem can be caused by a wrong or incomplete setup of MVC and Kentico applications. Therefore, in this article you will find a list of settings, which we recommend to check before submitting a ticket to Kentico Support.
I believe that you are already familiar with MVC support in Kentico – this support is based on a separate MVC application while Kentico functions as a separate application that you use as a content platform. Both Kentico and the MVC application access data from the same database and use the Kentico API. Content synchronization of, for example, smart search indexes, is handled by web farms.
The first thing you should check is the license: your current license must contain at least two web farm servers (if you have just a Kentico application and an MVC application and no additional web farm servers). You can verify this in the Licenses application. Additional information about MVC licensing can be found in our documentation.
As the next step, you should verify, that content synchronization mechanism is correctly configured. Web farm mode in the Settings application in the Versioning & Synchronization/Web farm section must be set to Automatic. The only exception is, if you plan to run the Kentico and MVC applications on the same domain (for example, distinguished by port numbers and run in different virtual folders). In either case, you can manually assign unique server names to the web farm servers via web.config keys as follows:
web.config file of MVC application: <add key="CMSWebFarmServerName" value="MVCApp"/>
web.config file of Kentico application: <add key="CMSWebFarmServerName" value="KenticoApp"/>
Even with the Automatic mode, this can help you to reliably identify which web farm server is able to access the database and which isn’t. With a correct license, you should see two web farm servers under the Web farm application with a green Healthy status:
Please keep in mind that the web farm server representing the MVC application must first be registered/initialized - this is done after the first requests. Because of that, it is necessary to perform a request to the MVC application.
As the last step, you must verify that you have correctly set up the MVC application as described in this documentation section.