This post is about hosting an ASPNET 5 application in IIS. By default ASPNET5 comes with Kestrel web server. You need to do following steps to host an ASPNET5 app in IIS.
- Compile and publish your application using dnu command like this.
This command will publish your application with active runtime, in my scenario, which “1.0.0-rc1-update1” CLR version and x64 platform. You can get the details of installed runtimes and active one using “dnvm list” command. The compiled output available in the bin folder inside your application directory.
- Create an application pool in IIS, with .NET CLR Version as no managed code option selected. Like this.
- Now create an application, make sure you’re selecting the application pool created in previous step.
- Physical Path of the application should point to the wwwroot of your published application.
- Make sure you’re IISPlatform handler installed, else you can download it from here
- You’re completed the configuration settings, you can browse your application.
If you’re using RC1 update1 like me, you may get a 404 instead of the default page. This is due to an defect with IIS Platform handler, you can resolve this by modifying code in the startup.cs, like this.
This code will help to map you’re application url to ASPNET5 application.
Happy Coding :)