March 2011 ยป Kentico CMS Quick Tip: Use IIS Express with Kentico 5.5 R2
Mar 21

Kentico CMS Quick Tip: Use IIS Express with Kentico 5.5 R2

Visual Studio 2010 Service Pack 1 is hot off the presses and it includes a great new feature, IIS Express. IIS Express is a step up from the old Cassini web server that had previously been included with Visual Studio since the 2005 edition. You can read more about IIS Express at Scott Guthrie’s blog.

To switch your Kentico project to use this new feature, you just need to go to the Visual Studio top menu after your solution is loaded, and click Website –> Use IIS Express.

From there you can debug the solution as normal. If you need any help with setting up a Kentico project for debugging check out my post about it. The project should start compiling normally and your default browser should pop up pointed your localhost. This request should now be served up through IIS Express and you should see the IIS Express logo appear in your system tray.

Sure enough that all worked for me, and after the default project loaded I was presented with a nice new shiny………error message.

Kentico CMS and IIS Express HTTP Error 500.22

Hmm that seemed odd to me. But as it turns out there is an HttpModule in the system.web node that IIS Express doesn’t like.

 

     <httpModules><add name=”XHtmlModule” type=”CMS.CMSOutputFilter.OutputFilterModule, CMS.OutputFilter”/></httpModules>

 

In IIS 7+ and IIS Express The HttpModules and HttpHandlers sections have been moved down to the System.WebServer node and not the top System.Web node. I also noticed that the offending module was already in the System.WebServer node. This means that it is safe to just remove the module from the top System.Web node.

After removing it and saving the Web.Config file my Kentico starter site came right up.

Kentico CMS Intranet Solution

There is actually more than one way to accomplish this, you could switch the Pipeline mode to Classic, or turn of Integrated mode validation checking, but I feel the solution above is the best one.

Bottom line: To make the default configuration of the Kentico CMS 5.5 Web installer work with the new IIS Express web server that comes with Visual Studio 2010 SP1, you need to remove the HttpModules node out of the System.Web node in the main Web.Config file of your Kentico solution.