You may run into an error with Windows 2003 Server and IIS 6.0 when trying to deploy an ASP.NET 4.0 web application.

<compilation debug=”true” targetFramework=”4.0”>
    <assemblies> 
        :
        :
    </assemblies>
</compilation>

Exception information:
    Exception type: ConfigurationErrorsException
    Exception message: Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive.

At this point there are two options:

  1. Configure IIS 6.0 to run the .NET 4.0 framework (more involved)
  2. Retarget your ASP.NET web application to use the .NET 3.5 Framework (easy)

Configure IIS 6.0 to run ASP.NET 4.0 web applications

  1. Open IIS 6.0 Manager
  2. Click Web Service Extensions
  3. Enable ASP.NET 4.0
    image
  4. Create a new application pool for your ASP.NET 4.0 web application
  5. Right click your ASP.NET 4.0 web application and select Properties
  6. In the ASP.NET tab select 4.0.30319
    image
  7. Click YES when prompted to restart IIS
    image
  8. Test your website

Retarget ASP.NET web application to use .NET 3.5

  1. Right click on a project in your solution and select properties
  2. From the Target framework drop down list select .NET Framework 3.5
    image
  3. Rebuild and deploy

Note: this method isn’t an option is you are using .NET 4.0 features or are using .NET 4.0 DLLs.

Comment