Tuesday, April 7, 2015

Install ASP.NET 4.5 into Windows Server 2012

Last week I was working on hosting an ASP.NET site in Windows Server 2012. As this was my first time to work with Windows Server 2012 I faced several hurdles. Somehow I managed to install IIS on it. There are tons of articles online to help me out. I found "http://www.iis.net/learn/get-started/whats-new-in-iis-8/installing-iis-8-on-windows-server-2012" this one was very helpful. Here I am not going to discuss how to install IIS. Hope the above article helps you too.

After installing IIS I configured my site. But it is not running, throwing some handlers error. Oh crap. I need to register ASP.NET into IIS. But irony was that “aspnet_regiis –i” not working. It throws an error.

"'aspnet_regiis' is not recognized as an internal or external command, operable program or batch file."


After couple of hours of searching I found aspnet_regiis is no more supported on Windows Server 2012. Microsoft introduced and new tool called DISM. Deployment Image Servicing and Management.

DISM can deploy services into your operating system from a Windows Image or from internet.

Syntax for DISM (for my purpose)

DISM.exe {/image:<path_to_image> | /online} [dism_options] {servicing_command} [<servicing_argument>]

{/image:<path_to_image> | /online}
This is the first parameter. It gives us an option from where to install the service from and Windows image or from online.


[dism_options]
Second parameter specifies what to do. Ex. enable-feature


{servicing_command}
Tell DISM what to install


My asp.net registration into IIS turned out as

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

Here /all tell DISM to install all dependency of ASPNET45.


 Finally my ASP.NET get installed on Windows Server 2012.

Happy Coding.. :)