none
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 RRS feed

  • Question

  • On a client's cloud server I have a clean install of windows server 2012 R2 and just installed IIS on it. For the IIS installation I selected all possible options so everything is installed. I setup a new website and copied files from an existing (working) website from another server to this new website.  The website's app pool is using dotnet 4.0 by default. 

    When I try to browse the default.aspx page I get the error shown below:

    However this server has the latest dotnet framework already installed:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319

    So I'm really stuck as to why I would be getting this error message.  As a test, I setup new Win2012 R2 server using our data center's cloud services and went through the exact same steps installing IIS on a new machine, setting up a new website and copied the exact same web site files to this new test site, and all worked good as expected. 

    There must be something in the client's environment that is causing the problem, but I don't know where to look.  Please advise.

    Thank you!

    • Moved by 宝宝徐 Friday, June 16, 2017 1:40 AM
    Monday, June 12, 2017 7:56 PM

Answers

  • I downloaded and installed the latest dotnet and that fixed it.  I really thought that would have been included in a new OS which had all the updates installed.

    Thanks for the help.

    • Marked as answer by moondaddy Saturday, June 17, 2017 6:08 PM
    Saturday, June 17, 2017 6:07 PM

All replies

  • Hi moondaddy,

    Thank you for posting in MSDN forum.

    Please change targetFramework="4.5" to

    <system.web>    
        
    <compilation debug="true" />
        
    <httpRuntime targetFramework="4.0" />
    </system.web>

    In addition, if you have any other question about IIS, you could also post in https://forums.iis.net/ for a much professional support.

    Thank you for your understanding and cooperation.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 13, 2017 2:28 AM
  • Hi Lana,

    Can you please explain why you would recommend these changes?  This is what I've used in maybe 100 or more websites with no problems up until now:

    <compilation targetFramework="4.6">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        <add assembly="Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </buildProviders>
    </compilation>

    Thank you.

    Tuesday, June 13, 2017 3:01 AM
  • Hi moondaddy,

    Thank you for your update.

    The root cause of this issue is that can't be recognized by IIS.  The reason to do the above change is both 4.6 and 4.0 use the 4.0 CLR in IIS. You could check if your application is using .net framework 4.0 pool.

    At the same time, please also go to Control Panel>Programs>Programs and Features>Turn Windows features on or off , Internet Information services> World Wide web Services,

    Check and install the .net extensibility 4.6 as below:

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by 宝宝徐 Wednesday, June 14, 2017 8:55 AM
    Tuesday, June 13, 2017 6:09 AM
  • I downloaded and installed the latest dotnet and that fixed it.  I really thought that would have been included in a new OS which had all the updates installed.

    Thanks for the help.

    • Marked as answer by moondaddy Saturday, June 17, 2017 6:08 PM
    Saturday, June 17, 2017 6:07 PM