[Mono-list] IHttpHandler works fine under IIS but not Apache
Mike Christensen
imaudi at comcast.net
Fri Apr 3 05:46:18 EDT 2009
Cool! I'll use this as well..
However, what if you wanted to build an app with a dynamic directory
structure. For example, you can create a user account called Peter on
MySpace and then go to www.myspace.com/Peter. However, I'm pretty sure
they don't have a directory on the filesystem called Peter, nor an alias
for Peter in their Apache config.
It would be nice to just disable this check, which is why I'm wondering
whether this is Apache or mod_mono doing this. IIS does not have this
problem.
Thanks again!
Mike
Peter Hagen wrote:
> Hi
>
> I fixed this by using an alias. I added an alias in the site
> configuration, and added the alias path to the web.config:
>
> Apache site config
>
> Alias /test "/some/real/path/to/my/site/www"
> <Location /test>
> SetHandler mono
> </Location>
>
> Web.config
>
> <configuration>
> <system.web>
> <httpHandlers>
> <add verb="*" path="/test/*"
> type="Willow.Cms.Common.WebServiceHandler, Willow.Cms.Common" />
> </httpHandlers>
> </system.web>
> </configuration>
>
> With this configuration you don't need to create the directory
>
> Cheers
>
> Peter
>
>
> Mike Christensen wrote:
>> This is already done.
>>
>> As I've stated in my email, this works for /Test.foo but not
>> /Blah/Test.foo. Apache requires the physical directory to exist on
>> the filesystem, otherwise it returns a 404.
>>
>> Ricardo Lopes wrote:
>>> Hi,
>>>
>>> You have to tell apache to send requests to *.foo to mod-mono, check
>>> your configuration.
>>>
>>> 2009/4/3 Mike Christensen <imaudi at comcast.net>:
>>>
>>>> Hi guys - I'm thinking this is most likely either an Apache
>>>> limitation,
>>>> a configuration problem, or a bug in mod-mono. I'm hoping it's the
>>>> latter so we can fix it :)
>>>>
>>>> Let's say I have an IHttpHandler:
>>>>
>>>> public class Handler : IHttpHandler
>>>> {
>>>> //Stuff here that will blow your mind
>>>> }
>>>>
>>>>
>>>> Now I register this in my web.config:
>>>>
>>>> <httpHandlers>
>>>> <add verb="*" path="*.foo" validate="false" type="Handler" />
>>>> </httpHandlers>
>>>>
>>>> Good so far right?
>>>>
>>>> When I go to:
>>>>
>>>> /Test.foo
>>>>
>>>> My handler will be invoked and it will do all sorts of great things
>>>> that
>>>> you simply can't imagine, probably change the world and all.
>>>>
>>>> However if I do:
>>>>
>>>> /Blah/Test.foo
>>>>
>>>> Then Apache gives me a default 404 File not found error.
>>>>
>>>> If I go and create a blank directory on the file system called Blah,
>>>> things will then work again. The point is, I do not want Apache or
>>>> anything else validating the filepath or directory structure. Keep in
>>>> mind there's web apps such as SharePoint that allow you to provision
>>>> webs, subwebs, etc and these paths are completely resolved by HTTP
>>>> handlers and are totally independent of the filesystem. Porting this
>>>> architecture over to Mono might cause problems.
>>>>
>>>> My question is what is actually to blame? Is Apache verifying the
>>>> directory before passing the request off to mod_mono? It obviously
>>>> doesn't validate the file itself since Test.foo doesn't exist anywhere
>>>> on the filesystem. I kinda think so because it's an Apache 404 error
>>>> page I'm getting, which depresses me. Also, this doesn't happen on
>>>> xsp
>>>> so I blame Apache. Anything I can do about this?
>>>>
>>>> On my app, I can hack around it by creating the directories or maybe
>>>> doing some hacks with vdirs and stuff, but is there a way we can
>>>> provide
>>>> a better experience? Thanks!!
>>>>
>>>> Mike
>>>> _______________________________________________
>>>> Mono-list maillist - Mono-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Mono-list maillist - Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>
More information about the Mono-list
mailing list