I've solved my problem. I'm approached as follows:
Firstly I've opened a command prompt and navigated to the following path: C:\Program Files (x86)\Common Files\microsoft shared\MSEnv
then I typed the command regsvr32 VsLangproj.olb
. Here is a helpful thread https://nuget.codeplex.com/workitem/3609
Afterwards I've managed the nuget packages when you go on TOOLS -> Nuget Package Manager -> Manage Nuget Packages for project maps
and updated the following packages:
ASP.NET MVC 5.2.3
ASP.NET Razor 3.2.3 ASP.NET WebAPI 2.2 Client Libraries 5.2.3
ASP.NET WebAPI 2.2 Core Libraries 5.2.3
ASP.NET WebAPI 2.2 Cross-Origin-Support 5.2.3
ASP.NET WebAPI 2.2 HelpPage 5.2.3
ASP.NET WebAPI 2.2 Tracing 5.2.3
ASP.NET WebAPI 2.2 Web Host 5.2.3
ASP.NET WebPages 3.2.3
Thirdly I've configured the following lines in the root Web.config of the WebAPI Project.
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
And the last change was in the Views/Web.config of the project:
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
Here I've changed the Version of Razor from 2.0.0.0 to 3.0.0.0 and now the API runs without problems! This thread was very helpful Site stopped working in asp.net System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to
Here is an exactly description how to update the MVC4 to MVC5:
http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
I hope the post is helpful for other users.