title: Configuration Error related to targetFramework in web.config
body: <p>I have made an MVC website in Visual Studio 2015 and it works in my localhost. But when I published my website and put into my host, it doesn't work. It gives me this error notice:</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>Configuration Error </p>
    
    <p>Parser Error Message: The 'targetFramework' attribute in the
     element of the Web.config file is used only to target
    version 4.0 and later of the .NET Framework (for example,
    ''). The 'targetFramework'
    attribute currently references a version that is later than the
    installed version of the .NET Framework. Specify a valid target
    version of the .NET Framework, or install the required version of the
    .NET Framework.</p>
    
    <p>Source Error: </p>
    
    <p>An application error occurred on the server. The current custom error
    settings for this application prevent the details of the application
    error from being viewed remotely (for security reasons). It could,
    however, be viewed by browsers running on the local server machine.</p>
    
    <p>Source File: G:\xxx\xxx.com\httpdocs\web.config    Line: 24 </p>
    
    <p>Version Information: Microsoft .NET Framework Version:4.0.30319;
    ASP.NET Version:4.0.30319.34248</p>
  </blockquote>
  
  <p>Related parts in my web.config:</p>
  
  <pre><code>  &lt;configSections&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;&lt;/configSections&gt;
  </code></pre>
  
  <p>And this part with error:</p>
  
  <pre><code>  &lt;system.web&gt;
      &lt;authentication mode="None" /&gt;
      &lt;customErrors mode="Off" /&gt;
      &lt;compilation debug="true" targetFramework="4.6" /&gt;
      &lt;httpRuntime targetFramework="4.6" /&gt;
    &lt;/system.web&gt;
  </code></pre>
  
  <p>Properties of my website:</p>
  
  <p><a href="https://i.stack.imgur.com/9qj3n.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9qj3n.png" alt="enter image description here"></a></p>
  
  <p>And NuGet Package Manager:</p>
  
  <p><a href="https://i.stack.imgur.com/Ig2sg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ig2sg.png" alt="enter image description here"></a></p>
  
  <p>EntityFramework Reference Properties:</p>
  
  <p><a href="https://i.stack.imgur.com/Nl8lu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Nl8lu.png" alt="enter image description here"></a></p>
  
  <p>Default Web Site Basic Settings: (To be honest, I am not sure whether I should add a new website(my website) in here.)</p>
  
  <p><a href="https://i.stack.imgur.com/Uexk9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uexk9.png" alt="enter image description here"></a></p>
  
  <p>My installed .net frameworks:</p>
  
  <p><a href="https://i.stack.imgur.com/KdaMQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KdaMQ.png" alt="enter image description here"></a></p>
  
  <p>My publish method:</p>
  
  <p><a href="https://i.stack.imgur.com/KD5gk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KD5gk.png" alt="enter image description here"></a></p>
  
  <p>I have investigated this problem on the Internet and I have found several links related to my problem: <a href="https://stackoverflow.com/questions/12143777/asp-net-mcv4-framework-issue">Asp.net MCV4 framework issue</a>. In this link, there are two main offers: </p>
  
  <ol>
  <li><p>changing this compilation tag</p></li>
  <li><p>updating application pool in IIS</p></li>
  </ol>
  
  <p>Actually, I have tried to change this tag but it doesn't change. Then I have controlled my application pool but it seems up-to-date.</p>
  
  <p><a href="https://i.stack.imgur.com/tMsrN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tMsrN.png" alt="enter image description here"></a></p>
  
  <p>I have called my host provider and I have explained my problem. They say that this error is not related to their servers.</p>
  
  <p>What should I do? What is the solution for this?</p>