title: MVC 4 website load shows HTTP Error 500.19
body: <p>I created a new ASP.NET MVC 4 application based on Internet application template, I could succesfully run it and authenticate user from within VS 2012 Express.</p>
  
  <p>Then published it to a folder in wwwroot, then in IIS 7.5 manager created a virtual directory pointing to that folder, and converted it to an application using a separate 4.0 integrated pool.</p>
  
  <p>When I tried to browse the application from within the IIS manager I get the next error:</p>
  
  <p>HTTP Error 500.19 - Internal Server Error, 
  The requested page cannot be accessed because the related configuration data for the page is invalid.</p>
  
  <p>Config Error:   Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ExtensionlessUrlHandler-Integrated-4.0' </p>
  
  <p>Config source:    </p>
  
  <pre><code>56:       &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/&gt;
  57:       &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /&gt;   
  58:     &lt;/handlers&gt;
  </code></pre>
  
  <p><a href="http://support.microsoft.com/kb/942055" rel="noreferrer">searched here</a>,I found the corresponding answer: </p>
  
  <p>Resolution 1</p>
  
  <p><strong>Delete the malformed XML element from the ApplicationHost.config file or from the Web.config file.</strong></p>
  
  <p>My web.config file is as below:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
      &lt;configuration&gt;
        &lt;configSections&gt;
          &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/&gt;
        &lt;/configSections&gt;
        &lt;connectionStrings&gt;
          &lt;add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-digixMVC4-20120915233326;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-digixMVC4-20120915233326.mdf" providerName="System.Data.SqlClient"/&gt;
        &lt;/connectionStrings&gt;
        &lt;appSettings&gt;
          &lt;add key="webpages:Version" value="2.0.0.0"/&gt;
          &lt;add key="webpages:Enabled" value="false"/&gt;
          &lt;add key="PreserveLoginUrl" value="true"/&gt;
          &lt;add key="ClientValidationEnabled" value="true"/&gt;
          &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt;
        &lt;/appSettings&gt;
  
        &lt;!--
          The following attributes can be set on the &lt;httpRuntime&gt; tag.
            &lt;system.Web&gt;
              &lt;httpRuntime targetFramework="4.5"/&gt;
            &lt;/system.Web&gt;
        --&gt;
        &lt;system.web&gt;
          &lt;compilation targetFramework="4.5"/&gt;
          &lt;httpRuntime/&gt;
          &lt;authentication mode="Forms"&gt;
            &lt;forms loginUrl="~/Account/Login" timeout="2880"/&gt;
          &lt;/authentication&gt;
          &lt;pages controlRenderingCompatibilityVersion="4.0"&gt;
            &lt;namespaces&gt;
              &lt;add namespace="System.Web.Helpers"/&gt;
              &lt;add namespace="System.Web.Mvc"/&gt;
              &lt;add namespace="System.Web.Mvc.Ajax"/&gt;
              &lt;add namespace="System.Web.Mvc.Html"/&gt;
              &lt;add namespace="System.Web.Optimization"/&gt;
              &lt;add namespace="System.Web.Routing"/&gt;
              &lt;add namespace="System.Web.WebPages"/&gt;
            &lt;/namespaces&gt;
          &lt;/pages&gt;
        &lt;/system.web&gt;
        &lt;system.webServer&gt;
          &lt;validation validateIntegratedModeConfiguration="false"/&gt;
          &lt;handlers&gt;
            &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/&gt;
            &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/&gt;
            &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0"/&gt;
            &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/&gt;
            &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/&gt;
  &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/&gt;
            &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" /&gt;      
          &lt;/handlers&gt;
        &lt;/system.webServer&gt;
        &lt;runtime&gt;
          &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
            &lt;dependentAssembly&gt;
              &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364g85"/&gt;
              &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/&gt;
            &lt;/dependentAssembly&gt;
            &lt;dependentAssembly&gt;
              &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364g85"/&gt;
              &lt;bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/&gt;
            &lt;/dependentAssembly&gt;
            &lt;dependentAssembly&gt;
              &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364g85"/&gt;
              &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/&gt;
            &lt;/dependentAssembly&gt;
          &lt;/assemblyBinding&gt;
        &lt;/runtime&gt;
        &lt;entityFramework&gt;
          &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/&gt;
        &lt;/entityFramework&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>As I am a poorly skilled developer in MVC 4, I would ask if someone could find out the malformed xml element in the file above.</p>