BlogEngine not working on IIS 7 host

Dec 17, 2008 at 5:46 AM
I have noticed that the URL rewriting is not working on my install. Every time I click on a post, category, or any link that gets rewritten, it turns up a 404 error. My site is currently hosted on a IIS 7 server and I know it supports url rewritting. The hosting site is reliablesite.net. Does anyone know how to fix this issue, or have experiencing getting this to work? Thanks!
Coordinator
Dec 17, 2008 at 5:52 AM
It sounds like the UrlRewrite module is not kicking in.  Do you have a <system.webServer> element in your Web.Config file with <modules> and <handlers> elements within system.webServer?  The Web.Config file starting in changeset 19453 has the <system.webServer> element in it.  I *think* only if you're in IIS7's integrated mode would you need the <system.webServer> element.
Dec 17, 2008 at 6:03 AM
Edited Dec 17, 2008 at 6:14 AM
Hi Ben, I was playing around with some stuff and I noticed that this line in my web.config caused the problem.

        <add key="BlogEngine.FileExtension" value=".html" />


If I change it to .aspx it works, any other value causes a 404 error on rewrites. Anyone know how I can fix this?

** I do have those sections in my system.webServer


<system.webServer>
        <validation validateIntegratedModeConfiguration="true"/>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="ScriptModule"/>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite" preCondition="managedHandler" />
      <add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule" preCondition="managedHandler" />
      <add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule" preCondition="managedHandler" />
      <add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule" preCondition="managedHandler" />
    </modules>
    <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory"/>
            <remove name="ScriptHandlerFactoryAppServices"/>
            <remove name="ScriptResource"/>
      <add name="FileHandler" verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" />
      <add name="ImageHandler" verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core"/>
      <add name="SyndicationHandler" verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core"/>
      <add name="SiteMap" verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" />
      <add name="TrackbackHandler" verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" />
      <add name="PingbackHandler" verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" />
      <add name="OpenSearchHandler" verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" />
      <add name="MetaWeblogHandler" verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" />
      <add name="RsdHandler" verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" />
      <add name="CssHandler" verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" />
      <add name="JavaScriptHandler" verb="*" path="js.axd" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" />
      <add name="RatingHandler" verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" />
      <add name="OpmlHandler" verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" />
      <add name="MonsterHandler" verb="*" path="monster.axd" type="BlogEngine.Core.Web.HttpHandlers.MonsterHandler, BlogEngine.Core" />
      <add name="BlogMLExportHandler" verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" />
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
  </system.webServer>

Coordinator
Dec 17, 2008 at 6:12 AM
Can't you keep the value at .aspx?  That's the default extension.  You need it to be .html?

By the way, the preCondition="managedHandler" settings you have in there ... this makes it so IIS7 doesn't pass on any requests for .HTML extensions to ASP.NET.  If you remove preCondition="managedHandler", then all requests will be passed onto ASP.NET and BlogEngine.
Dec 17, 2008 at 6:18 AM
I removed all the preConditions and it still throws a 404 error. I would like to use .html for the extension, or actually have no extension.
Coordinator
Dec 17, 2008 at 6:24 AM
Hmm..  Not sure if this is the problem, but I did notice that Web.Config in these recent versions of BlogEngine has validateIntegratedModeConfiguration="false", where you have "true".  I've pasted the system.webServer section of the most recent Web.Config file (1.4.5.13).  Maybe try swapping out your system.webServer section with the one below?

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
            <add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
            <add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
            <add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
            <add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
        </modules>
        
        <handlers accessPolicy="Read, Write, Script, Execute">
            <add name="FileHandler" verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core"/>
            <add name="ImageHandler" verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core"/>
            <add name="Syndication" verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core"/>
            <add name="Sitemap" verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core"/>
            <add name="Trackback" verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core"/>
            <add name="Pingback" verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core"/>
            <add name="OpenSearch" verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core"/>
            <add name="MetaWeblog" verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core"/>
            <add name="RSD" verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core"/>
            <add name="CssHandler" verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core"/>
            <add name="Javascript" verb="*" path="js.axd" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core"/>
            <add name="Rating" verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core"/>
            <add name="Opml" verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core"/>
            <add name="BlogML" verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core"/>
            <add name="SIOC" verb="*" path="sioc.axd" type="BlogEngine.Core.Web.HttpHandlers.Sioc, BlogEngine.Core"/>
            <add name="Apml" verb="*" path="apml.axd" type="BlogEngine.Core.Web.HttpHandlers.Apml, BlogEngine.Core"/>
            <add name="Foaf" verb="*" path="foaf*.axd" type="BlogEngine.Core.Web.HttpHandlers.Foaf, BlogEngine.Core"/>
        </handlers>
    </system.webServer>
Dec 17, 2008 at 6:31 AM
No change :(
Coordinator
Dec 17, 2008 at 6:39 AM
:-(   Do you know if your website is running in IIS7's integrated mode?  If not (i.e. you're in Classic Mode), then I think only regular ASP.NET extensions will be processed by ASP.NET.  If you were in Classic Mode, then the HTML extension would need to be mapped to aspnet_isapi.dll in IIS.  If you're in integrated mode, then your web.config file controls whether HTML extensions are handled by ASP.NET.  We want integrated mode.
Dec 17, 2008 at 6:52 AM
I'm not sure how to tell or where that option would be. I did find something in my control panel under "extensions" that list

None
2.0
2.0 intergrated pipeline


I updated to 2.0 integrated pipline and now the site returns a 500 error and is completely hosed. Ugh, I am going to email tech to get that fixed, but I know they have no idea about url rewriting from blog engine.

Coordinator
Dec 17, 2008 at 6:57 AM
Yeah, see if support can help at all.  To get BE working with .HTML extensions, I think you're definitely going to want integrated mode.  Hopefully just switching back to what it was before would eliminate the 500 errors.  When you get things stable again, you might want to try and figure out what's causing the 500 errors while in integrated mode, or maybe even try starting off with the latest Web.Config file (in 1.4.5.13) and putting your site specific settings into that.
Coordinator
Dec 17, 2008 at 7:03 AM
By the way, I see on reliablesite.net's community forums, one of the employees there mentioned they will map any file extension to the .NET ISAPI module if you request it.

http://forum.reliablesite.net/index.php?topic=154.msg717#msg717

So, if you can't get integrated mode working, you could send in a support request and ask them to map your site's HTML extension to the .NET ISAPI module.
Dec 17, 2008 at 7:14 AM
Thanks for all your help Ben!