Kentico 10 MVC, IISExpress

Frédéric Caplet asked on August 21, 2017 17:19

Hello Every one.

We are moving from Kentico 8 (ASPX Template) to Kentico 10 MVC for our new project.

The deploy target is Azure Env. with a deployement of the CMS at the root and MVC site as a Sub WebApplication folder.

We setup blank MVC from Kentico Installer. Open Solution in VS. Added a New Project (Asp.Net MVC). import Kentico NuGet Package on MVC project.

During developpement stage we expect to use IISExpress (as we did previously with Kentico 8 ASPX Template). So we defined IIS Express accordingly.

http://localhost/admin serve kentico back office as expected. http://localhost/mvc gives an error: CS0234: The type or namespace name 'Web' does not exist in the namespace 'CMS.Base' (are you missing an assembly reference?)

Line 48:       <namespaces>
Line 49:         <add namespace="CMS.Helpers"/>
Line 50:         <add namespace="CMS.Base.Web.UI"/>
Line 51:       </namespaces>
Line 52:     </pages>

If mvc site is provided outside of IISExpress WebApplication (Http://localhost:xxxx/), the site doesn't throw this error.

Any idea what cause the error and solution to solve it ?

Thank you.

Correct Answer

Prashant Verma answered on August 23, 2017 06:56

Hi Frédéric,

You must need to configure MVC project with this Configurations

1.install the Kentico.Web.Mvc integration package in your MVC application project.

2.In the MVC application's Global.asax file, add a reference to Kentico.Web.Mvc.

3.In the Views\web.config file, add the Kentico.Web.Mvc namespace.

How to use-asp-net-mvc-with-kentico-cms

2 votesVote for this answer Unmark Correct answer

Recent Answers

Frédéric Caplet answered on August 23, 2017 09:50

Hello Prashant,

Thank you very much for your answer. Everything was configured as explained by the link you provided... except the presentation URL that mismatched the MVC IISExpress URL.

Thank you!

0 votesVote for this answer Mark as a Correct answer

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