views:

112

answers:

1

I'm using Windows 7 (IIS 7.5) and have been struggling with getting it setup to use extensionless url's. This is what my web.config looks like:

<system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
        <clear />
        <add name="ASPX" path="*.aspx" verb="*" type="" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="4194304" />
        <add name="StaticF" path="*.*" verb="FILE, GET" type="" modules="StaticFileModule" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
        <add name="MR" path="*" verb="*" type="" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="4194304" />
    </handlers>
    </system.webServer>

Going to any url without an extension gives a 404 - resource cannot be found error thrown by ASP.NET. Any help would be greatly appreciated.

+1  A: 

Assuming you do not want regular webforms you could remove the "ASPX" line

As for the mapping of "*" to MR, you need another handler factory to set in the "type" attribute:

<add name="MR" path="*" verb="*" 
     type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory, 
           Castle.MonoRail.Framework" 
     modules="ManagedPipelineHandler" 
     scriptProcessor="" 
     resourceType="Unspecified" 
     requireAccess="Script" 
     allowPathInfo="false" 
     preCondition="" 
     responseBufferLimit="4194304" /> 
Ken Egozi
Thanks for the reply. If I go to "http://localhost/mysite" then I get "Url smaller than 2 tokens". If I add a slash or go to "http://localhost/mysite/home" then I get "Controller not found. Area: '' Controller Name: ''" If I go to "http://localhost/mysite/home/index" then the page shows up but all the static files (css, images, etc...) cannot be found.
Justin
For the static content, here's a sample css file: http://localhost:88/content/css/blueprint/plugins/buttons/screen.css - and here's the error: "Controller not found. Area: 'content/css/blueprint/plugins' Controller Name: 'buttons"
Justin
As for the static content - the error indicate that ASP.NET is going for the MR handler.you need to make sure that the MR handler is listed last on the <handlers> tag since it is a wildcard mapping, and will suppress anything after it. also, try setting a handler for css explicitly: `<add name="CssFiles" path="*.css" verb="GET" modules="StaticFileModule" scriptProcessor="" resourceType="File" requireAccess="Script" />`
Ken Egozi
As for the root mapping into a specific controller/action, you should ask around for this. also look into `http://www.kenegozi.com/blog/2009/02/10/monorail-routing-and-the-homepage-routing-rule.aspx`
Ken Egozi
Thanks, I still get the "Url smaller than 2 tokens" error but the static files work now. I posted on your blog about the smaller than 2 tokens error.
Justin