Wednesday, January 9, 2013

*.cshtml files return html error 404 in BlogEngine.NET 2.5

HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
The solution is, to add the following handlers to web.config:
<system.webServer>
  <handlers>
    <add name="cshtml-ISAPI-4.0_32bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" 
         modules="IsapiModule" 
         scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" 
         preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />   
    <add name="cshtml-ISAPI-4.0_64bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" 
         modules="IsapiModule"
         scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" 
         preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="cshtml-Integrated-4.0" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" 
         type="System.Web.HttpForbiddenHandler" 
         preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

No comments:

Post a Comment