Create your First MVC Project in Umbraco (ver 6)

Here, I am going to create a new blank Mvc4 Project in Microsoft Visual Studio 2010 and then I will add Umbraco 6.0.3 package to it. In this process, unfortunately, you may encounter couple of bugs, which have been highlighted in yellow.

Following are the steps needed to perform to implement this

    • Create an empty MVC 4 project in Visual Studio.
    • Add the NuGet Umbraco Cms Core Binaries package to manage various dependencies and references that Umbraco 6 requires. To do this open Package Manager Console (From the Tools menu, select Library Package Manager and then click Package Manager Console.) and type Install-Package UmbracoCms.Core -Version 6.0.3


    • Download and copy all the files from the Umbraco installation ZIP archive directly into your project in Visual Studio except the App_Code and Bin folders – you won’t need the binaries as they are managed by NuGet and the App_Code folder is not used in a web application project.
    • Change the default mode for Umbraco from web forms to Mvc in the defaultRenderingEngine setting in the Umbraco configuration file UmbracoSettings.config as shown below:

Unfortunately, if you run the application now, you may encounter the error ApplicationException: The current httpContext can only be set once during a request

The solution is to do the following in the web.config file.
Copy the httpModules tag and keep it handy for later use.

Add the node:  <add name=”umbracoRequestModule” type=”umbraco.presentation.requestModule” />

Add the node: <add name=”umbracoBaseRequestModule” type=”umbraco.presentation.umbracobase.requestModule” />

Comment out: <!–<add name=” UmbracoModule” type=”Umbraco.Web.UmbracoModule,umbraco” />–>

Following is the code snippet of the same

  <!-- URL REWRTIER -->
  <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
  <add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
  <!-- UMBRACO -->
  <!--<add name=" UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />-->
  <add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
  <!-- ASPNETAJAX -->
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />

Now the application will debug successfully and the Umbraco installation wizard will start to configure Admin and DataBase details. The 5 steps of the wizard are displayed below.

Following articles were consulted to compose this blog. For more details of any particular domain click on the appropriate link below :-

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.