How do I fix the "compilerVersion" IIS error?

I'm getting this exception:

System.Configuration.ConfigurationErrorsException: The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework.

What should I do to resolve this?

5 Ways To Fix YouTube, Click here to Tweet the CEO of YouTube ➡ http://ctt.ec/j5fxd Subscribe For More Videos ➡ http://bit.ly Duration: 10:35 Posted: Mar 21, 2016 iFixit is a global community of people helping each other repair things. Let's fix the world, one device at a time. Troubleshoot with experts in the Answers forum—and build your own how-to guides to share with the world.

this should help

<configuration>
<!--  -->
<system.codedom>
 <compilers>
  <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
    type="Microsoft.CSharp.CSharpCodeProvider,System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <providerOption name="CompilerVersion" value="v4.0"/>
   <providerOption name="WarnAsError" value="false"/>
  </compiler>
 </compilers>
</system.codedom>
<!--  -->
</configuration>

How To Fix Your iPhone Screen Yourself, A CNBC reporter recently broke the screen on his iPhone and decided to replace it himself using Duration: 2:03 Posted: Aug 1, 2018 Fortunately, while there are service outages you can’t do much about, you can often fix typical problems yourself. To help get your Zoom calls working properly again, we’ve collected the most

In my case, I was trying to run a child application using 4.0, but the parent application needed to still use 2.0. Wrapping the compilers information in the parent web.config with a <location path="." inheritInChildApplications="false"> tag fixed it.

Parent Web.config:

<location path="." inheritInChildApplications="false">
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>

How to Fix Everything, Umbra visits the Fixers' Collective in Brooklyn, a social experiment in improvisational fixing Duration: 2:53 Posted: Mar 9, 2010 2. Fix Any Errors on Your Credit Reports. Once you’re looked at your credit reports, you want to fix any errors you find. For most people, the process of fixing errors on credit reports is known as credit repair. Credit repair is something you can do on your own.

Remove this section from web.config

<compilation debug="true" strict="true" explicit="true"  targetFramework="4.0" />

How to Fix Any Problem: The 3 Step Approach, While the content of the problems we are forced to deal with every day constantly changes, the basic approach we need to put the problem to� What we desperately need, but have so far lacked, is political will. America needs to do more than throw good reform dollars at bad agencies. Elected officials at all levels—federal, state, and

In my case it was a child site under the Default Website and although the default website settings were set at ASP.NET 4.0, the web.config file was set for 2.0 and 3.5. Changing the web.config file to use 4.0 fixed it. Use this for reference: ASP.NET 4 Breaking Changes

Fix a Problem | Facebook Help Center, Fix a Problem. How do I report that something isn't working on Facebook? This process is for reporting something on Facebook that isn't working correctly, like a � To fix this problem, follow these steps: Click Start, and then click All Programs.; Click Accessories, right-click Command Prompt, and select Run as administrator. If you are prompted for an administrator password or for confirmation, type the password or provide confirmation.

AC Repair: How to Troubleshoot and Fix an Air Conditioner (DIY , AC not working? Save big bucks - troubleshoot and fix AC problems yourself! Learn how to fix an air conditioner with Family Handyman. (Pictures and step by�

How to fix the most common smartphone problems, Most smartphone problems fall into just a few categories, like dwindling battery life or random crashes. Here's how to solve the worst phone�

Fix the Process, Not the Problem, Together, managers and mill workers learned to take the initiative not just for identifying problems but also for developing better processes for fixing problems �

Comments
  • Thanks for this answer. Worked great.
  • 4igi answer has the C# 4.0 answer.
  • As a side note to "2.0 was used instead of 3.5": The solution above worked for me too in this scenario. But I finally found out WHY the wrong compiler was being used: I'm using a "Web Deployment Project" to compile the web application and it seems it doesn't understand "CodeFile=" in aspx/ascx files (and doesn't find any ".cs" files). The legacy name "CodeBehind=" works though and the "web.config"-hack above is no longer needed. *** MSVC2010, .NET 2.0 with 3.5 Code ***
  • Looking at John K's references, most of the compiler element options are exactly that - optional! So, I had a similar issue with C# and vb in the same website project. The VB stuff was not working, most likely due to setting incorrect version, but we wanted any and all builds of this warning type to be ignored, so I added the compiler element with only the option I wanted: nowarn. <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="1" compilerOptions="/nowarn:618,612,40000" />
  • This one helped my situation. We did not have any problems with a mixed .Net versions on the server until a vendor MSI was run.
  • Nice...this fixed my problem (ASP.NET 4 site is child of ASP.NET 2.0)
  • I didn't see you that you answered your own question before I finished filling mine out :)
  • Yea, but yours was more complete.
  • Also need to remove <httpRuntime targetFramework="4.5" /> in 4.5.
  • For me, I had a nested <assemblies> block in <compilation>. So I just removed all the attributes and ended up with <compilation><assemblies>...</assemblies></compilation>.
  • This helped me. Thanks. I had copied a 3.5 project and changed it to 4.0, but couldn't get it to work correctly until I did this.