Kentico V12 MVC getting "The preview feature is not enabled." error

Rui Wang asked on March 27, 2019 13:11

I'd like to share this client case with you so the answer can be found.

The client created new MVC solution in VS. Added all the NuGet packages needed for Kentico 12 MVC development. He created page type with page tab enabled for page builder function. All the models, controllers and views are in place. The documentation for using the Preview was followed as well

Then he gets this error message after the build and browse in browser.

The preview feature is not enabled. You need to call the 'UsePreview()' method of the Kentico.Web.Mvc.ApplicationBuilder instance at the start of your application's life cycle. The code is targeted for Framework 4.6.1.

Image Text

Correct Answer

Rui Wang answered on March 27, 2019 13:13

After troubleshooting, the cause of this is he is missing this line in the web.config <system.webServer><modules> section. Once added, the view appears without the error.

<modules>
      <add name="CMSApplicationModule" preCondition="managedHandler" type="CMS.Base.ApplicationModule, CMS.Base"/>
</modules>

Additional note: The above line should be added automatically when installing the Kentico.AspNet.Mvc NuGet package. But in the client's case, he had a web.master.config which overwrites the regular web.config during build each time. Since this line was only added to the web.config, and was never copied to his master.config, it got removed without him noticing it.

2 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.