다음을 통해 공유


Configuration error, targetFramework 4.7

I was deploying some code to one of my IIS servers and got this YSOD as seen in Figure 1.  I had coded in Visual Studio 2017 with the .NET Framework 4.7 targeted from my ASP.NET Web Forms application I wrote.

image

Figure 1, Server Error, targetFramework=”4.7”

 
Server Error in "/" Application.

Configuration Error 
  Description: An error occurred during the processing of a configuration file required to 
               service this request. Please review the specific error details below and modify 
               your configuration file appropriately. 

  Parser Error Message: The "targetFramework" attribute in the "compilation" element of the 
                        Web.config file is used only to target version 4.0 and later of the .NET 
                        Framework (for example, "compilation targetFramework="4.0""). 
                        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.

Source Error: 

Line 6:  <configuration>
Line 7:    <system.web>
Line 8:      <compilation targetFramework="4.7" />
Line 9:      <httpRuntime targetFramework="4.7" />
Line 10:  </system.web>  

 Source File:  C:\inetpub\TcpClientTest\web.config    Line:  8 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0 

I like to look at the version of the mscorlib.dll file to see what version of the .NET Framework I have on my machine.  When I looked, sure enough I had 4.6.1.  See Figure 2.

image

Figure 2, how I check to see which version of the .NET Framework I am running

Once I installed 4.7 I checked again and saw this illustrated in Figure 3, as expected.

image

Figure 3, how I check to see which version of the .NET Framework I am running

I also just commented out the targetFramework referecnes in my web.config file and because I wasn’t doing anything only available in the 4.7 version of the .NET Framework, my ASP.NET Web Forms application ran fine with 4.6.1.

Comments

  • Anonymous
    April 26, 2019
    Did you solve this problem or did it ever go away?