BlogEngine.NET on IIS7+Win2k8+Integrated Pipeline ASP.NET 2.0

Topics: ASP.NET 2.0
Nov 8, 2007 at 8:59 PM
Edited Nov 8, 2007 at 9:16 PM
Hi guys!

I've been a fan of BlogEngine.NET (it's way faster than Wordpress and more lightweight than Subtext) and recently, I've successfully tested BlogEngine.Net on Windows 2008 Server RC0 running IIS 7.0. The blog runs in an ASP.NET 2.0 Integrated Pipeline application pool.

Since the introduction of <system.webServer> configurations in web.config, BlogEngine.NET's web.config has been constantly harassed by hosting control panels (Especially DotNetPanel for IIS7), leading to the dreaded HTTP 500 page that shows no detail of errors.

The solution is simple, if you have IIS7 running on your local computer, just run:

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "<virtual path to your blog application, eg Default Web Site/blog>"

APPCMD will automatically migrate the classic web.config to be compatible with the Integrated Pipeline web.config.

Here's what APPCMD has added to the file:

<system.webServer>
<modules>
<remove name="Profile" />
<remove name="AnonymousIdentification" />
<add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite" preCondition="managedHandler" />
<add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule" preCondition="managedHandler" />
<add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule" preCondition="managedHandler" />
<add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule" preCondition="managedHandler" />
</modules>
<handlers>
<add name="blogml.axd_" path="blogml.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="monster.axd_" path="monster.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.MonsterHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="opml.axd_" path="opml.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="rating.axd_" path="rating.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="css.axd_" path="css.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.CssHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="rsd.axd_" path="rsd.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="metaweblog.axd_" path="metaweblog.axd" verb="" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="opensearch.axd_" path="opensearch.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="pingback.axd_" path="pingback.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="trackback.axd_" path="trackback.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="sitemap.axd_" path="sitemap.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.SiteMap" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="syndication.axd_" path="syndication.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="image.axd_" path="image.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="file.axd_" path="file.axd" verb="" type="BlogEngine.Core.Web.HttpHandlers.FileHandler" preCondition="integratedMode,runtimeVersionv2.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
<security>
<authentication>
<basicAuthentication enabled="false" />
</authentication>
</security>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
</files>
</defaultDocument>
<httpRedirect enabled="false">
<clear />
</httpRedirect>
</system.webServer>

Hope that helps!
Nov 9, 2007 at 9:34 PM
Edited Nov 9, 2007 at 10:12 PM
I am going working on getting the bugs out for my installation on Longhorn-IIS7, hosted by CrystalTech

#1 Had generic 500 error, Had to find a Vista Machine to do the AppCmd on- my changes/additions do not match yours
#2 New error 501, regarding Request is Not Available. Searching forums etc I found an easy fix- disable the auto culture in globalization
#3 Now it runs; limping, with 401.x errors for subfolders of the blog application- many pictures missing
#4 Checked IIS & NTFS permissions on the server RE#3, they are OK
#5 Added web.config file to pic directory with allow permissions
Nov 14, 2007 at 9:22 PM
Up and running now.

I do not know why I was getting authentication issues, but I downloaded my App_Data and then killed the application/contents on the server and then redeployed the application
Apr 3, 2009 at 8:42 AM
Thanks! This saved my day, after switching from IIS 6 to a new IIS 7 server.

Since then, I wasn't able to use MS Word, or Windows Liver Writer anymore to post new posts. The metaweblog.axd handler was not found, therefor the application wasn't able to submit posts.

After adding 

<add name="metaweblog.axd_" path="metaweblog.axd" verb="" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler" preCondition="integratedMode,runtimeVersionv2.0" />

to the web.config file, everything worked fine again.

Thanks again,
Peter.