As a side note, I broke the default-document behaviour aswell with my
config (maybe because I removed the .aspx handler) but a quick fix for
that was to add a default routing that points to my default
controller/action like this:
rule = new PatternRoute( "default", "/" )
.DefaultForController().Is<HomeController>().DefaultForAction().Is(
"index" );
RoutingModuleEx.Engine.Add( rule );
It could aswell be because I no longer have a
DefaultDocumentHandler-mapping to * since everything is mapped to MonoRail.
Mike Nichols wrote:
> Jimmy
> Here's my relevant web.config bits for IIS7...you can probably
> disregard the aspx and ashx entries. This presumes an separate site
> handling static resources :
> <system.webServer>
> <modules>
> <!--do not clear-->
> <remove name="ScriptModule"/>
> <add name="routingEx"
> type="Castle.MonoRail.Framework.Routing.RoutingModuleEx,Castle.MonoRail.Framework"
> preCondition="managedHandler"/>
> <add name="PerRequestLifestyle"
> type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule,Castle.MicroKernel"
> preCondition="managedHandler"/>
> <add name="ScriptModule" preCondition="managedHandler"
> type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
> Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></
> modules>
> <handlers accessPolicy="Script, Execute, Read">
> <clear/>
> <add name="ASPX" path="*.aspx" verb="*"
> type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified"
> preCondition="integratedMode"/>
> <add name="AssemblyResourceLoader-Integrated"
> path="WebResource.axd" verb="*"
> type="System.Web.Handlers.AssemblyResourceLoader"
> resourceType="Unspecified" requireAccess="Read"
> preCondition="integratedMode"/>
> <add name="Block-Boo" path="*.boo" verb="*"
> type="System.Web.HttpForbiddenHandler, System.Web"
> modules="ManagedPipelineHandler" scriptProcessor=""
> resourceType="Unspecified" requireAccess="Script"
> preCondition="integratedMode,runtimeVersionv2.0"/>
> <add name="Block-Brail-JS" path="*.brailjs" verb="*"
> type="System.Web.HttpForbiddenHandler, System.Web"
> modules="ManagedPipelineHandler" scriptProcessor=""
> resourceType="Unspecified" requireAccess="Script"
> preCondition="integratedMode,runtimeVersionv2.0"/>
> <add name="Block-Brail" path="*.brail" verb="*"
> type="System.Web.HttpForbiddenHandler, System.Web"
> modules="ManagedPipelineHandler" scriptProcessor=""
> resourceType="Unspecified" requireAccess="Script"
> preCondition="integratedMode,runtimeVersionv2.0"/>
> <add name="Monorail-All" path="*" verb="*"
> type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
> Castle.MonoRail.Framework" modules="ManagedPipelineHandler"
> scriptProcessor="" resourceType="Unspecified" requireAccess="Script"
> preCondition=""/>
> <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>
> <validation validateIntegratedModeConfiguration="false"/>
> </system.webServer>
>
> When using the RoutingModuleEx you'll probably use the fluent config
> in c#. I have all my rules in a RoutingService that gets initialized
> just after Application_Start.
> Not sure what's causing your other issue. Are you pulling the image in
> thru an xhr or regular request?
>
> On Oct 22, 8:45 am, Jimmy Shimizu <[EMAIL PROTECTED]> wrote:
>
>> Okay, I have somewhat solved it now. Seems like the new routing-engine
>> doesn't even bother with web.config rules, if I did them in
>> GlobalApplication it worked.
>> public override void Application_OnStart() {
>> var rule = new PatternRoute("images", "/images/<id>/<size>.jpg")
>>
>> .DefaultForController().Is<ResourceController>().DefaultForAction().Is("image")
>> .Restrict("id").ValidInteger;
>>
>> RoutingModuleEx.Engine.Add(rule);
>>
>> }
>>
>> Now it works, but the odd thing is... that after an app-restart, it
>> works, sort of. invalid ids will throw an exception and handled by my
>> rescue. But once I make a successful load of an image, all other
>> requests will get the same image. Explanation:
>>
>> /images/1/mini.jpg <-- works
>>
>> /images/100/big.jpg <-- gives the same image. Should call the rescue.
>>
>> images/1/big.jpg <-- same image, should render a big image.
>>
>> Looking through my logs, I can see that it actually invokes Image() in
>> my ResourceController the frist time, but not anymore after the initial
>> request.
>>
>> Although, the request goes through BeginRequest, AuthenticateRequest and
>> EndRequest atleast. Is there any weird caching per controller that
>> doesn't really get that I pass on other querystring-arguments to the
>> controller with the rewriting?
>>
>> Jimmy Shimizu wrote:
>>
>>> Hi, I'm trying to get the routing working on an IIS7 setup but I'm not
>>> sure if there is IIS7 that gives me problem or if I'm doing something wrong.
>>>
>>> This is my setup:
>>>
>>> <system.webServer>
>>> <modules>
>>> <add name="routingEx"
>>> type="Castle.MonoRail.Framework.Routing.RoutingModuleEx,Castle.MonoRail.Framework"
>>> preCondition="managedHandler" />
>>> </modules>
>>> <handlers>
>>> <clear />
>>> <add name="MonoRail" path="*" verb="*"
>>> type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
>>> Castle.MonoRail.Framework" preCondition="integratedMode" />
>>> <add name="vm" verb="*" path="*.vm"
>>> type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" />
>>> <add name="boo" verb="*" path="*.boo"
>>> type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" />
>>> <add name="st" verb="*" path="*.st"
>>> type="System.Web.HttpForbiddenHandler" preCondition="integratedMode" />
>>> </handlers>
>>> <validation validateIntegratedModeConfiguration="false" />
>>> </system.webServer>
>>>
>>> And in my <monorail> I have:
>>>
>>> <routing>
>>> <rule>
>>> <pattern>/images/(\d+)/(\w+)\.jpg$</pattern>
>>> <replace><![CDATA[
>>> /resource/image.rails?size=$2&imageID=$1 ]]></replace>
>>> </rule>
>>> </routing>
>>>
>>> Basically, what I want to do is replace /images/1/small.jpg to
>>> /resource/image.rails?imageID=1&size=small
>>>
>>> However, it doesn't seem to kick in, since I get
>>>
>>> //Controller not found. Area: 'images' Controller Name: '1'
>>>
>>> //I've read that IIS7 and integrated mode gives you trouble with the
>>> routing, but never any solution to the problem or any real explanation
>>> to why that is. I'm a little dazzled about how .NET actually know about
>>> IEngineContext since I don't specify that anywhere in my Web.config, all
>>> I have is the handler that maps to MonoRailHttpHandlerFactory. Is that
>>> the issue, that the Routing doesn't kick in before the handler?
>>>
>>> And I haven't seen any way to get useful debugdata regarding the routing...?
>>>
>>> When people give example where they configure the routing in code, where
>>> do they do that? Application_OnStart? How do they access RoutingEngineEx
>>> in that case?
>>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---