Wednesday, January 1, 2014

Install ASP.NET With DISM.EXE on Windows 8

If you are trying to run your ASP.NET website on IIS8 on a WIndows 8 machine, you are possibly going to get the following error:
The requested content appears to be script and will not be served by the static file handler
On previous windows versions, running aspnet_reqiis.exe -i was sufficient. Unfortunately aspnet_reqiis.exe no longer works on windows 8, and we are required to use a new tool - DISM.EXE.

Quoting Microsoft info about DISM:
Deployment Image Servicing and Management (DISM) is a command-line tool used to service Windows® images offline before deployment. You can use it to install, uninstall, configure, and update Windows features, packages, drivers, and international settings. Subsets of the DISM servicing commands are also available for servicing a running operating system.
DISM is installed with Windows® 7, and it is also distributed in the Windows OEM Preinstallation Kit (Windows OPK) and the Windows Automated Installation Kit (Windows AIK). It can be used to service Windows Vista® with Service Pack 1 (SP1), Windows Server® 2008, Windows® 7, Windows Server® 2008 R2, or Windows PE images. DISM replaces several Windows OPK tools, including PEimg, Intlcfg, and Package Manager.
So in order to install ASP.NET with DISM via command line - run the following line:

dism /online /enable-feature /all /featurename:IIS-ASPNET45

More info on Microsoft Support


If you are using WCF services, then you'll need to enable those also with DISM:
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation 
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45