Troubleshooting

"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."

Compilation

app_code classes not working

If your application is a Web Application project rather than a Web Site project, the code files should not be in the App_Code folder

Build

Unable to copy file "obj\Debug\Config.dll" to "bin\Debug\Config.dll". The process cannot access the file 'bin\Debug\Config.dll' because it is being used by another process.

Web.config

The 'configuration' element is not declared.

Open the file

Go to XML menu (visual studio top menu item) choose schemas and find for DotNetConfig.xsd and choose use this schema.

Execution Errors

System.DirectoryServices.ResultsEnumerator.MoveNext search filter is invalid

Disable "Allow Anonymous"

HTTP Errors

HTTP 404

HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Solution

<system.webServer>
     <staticContent>
      <remove fileExtension=".woff"/>
      <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
      <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
    </staticContent>
  </system.webServer>

MVC

Error after MVC has been upgraded from v2 to v3

Error:

[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0

Solution update the web.config in Views folder

  <!--<configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>-->

  <configSections>
    <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>
  </configSections>

and the web.config in root folder

    <!--<add key="webpages:Version" value="2.0.0.0" />-->
    <add key="webpages:Version" value="3.0.0.0" />

results matching ""

    No results matching ""