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:
- Configure IIS 6.0 to run the .NET 4.0 framework (more involved)
- 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
- Open IIS 6.0 Manager
- Click Web Service Extensions
- Enable ASP.NET 4.0
- Create a new application pool for your ASP.NET 4.0 web application
- Right click your ASP.NET 4.0 web application and select Properties
- In the ASP.NET tab select 4.0.30319
- Click YES when prompted to restart IIS
- Test your website
Retarget ASP.NET web application to use .NET 3.5
- Right click on a project in your solution and select properties
- From the Target framework drop down list select .NET Framework 3.5
- 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.