I have a ASP .NET 4.5.2 MVC web application running on an IIS website and I wanted to run a separate ASP .NET 4.5.2. web api application under the MVC web site.
Both projects worked just fine, when hosting them as separate IIS websites, but when the web api was “mounted” as virtual web application under the MVC website I was getting the errors below, when hitting the web api application:
error CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Line 150: <pages controlRenderingCompatibilityVersion="4.0"> Line 151: <namespaces> Line 152: <add namespace="System.Web.Helpers" /> Line 153: <add namespace="System.Web.Mvc" /> Line 154: <add namespace="System.Web.Mvc.Ajax" />
So I was hitting the web api, but got an error on the parent MVC web application???
Turns out, I had to remove these namespaces in the web api web.config, because those dll’s are not in the web api project.
Adding the following lines to the web.config of the web api project, solved the errors.
<configuration>
<system.web>
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<clear/>
</namespaces>
</pages>
…