简体   繁体   中英

Page not found when trying to access HttpHandler with IIS 5.1

The problem is as follows:

I have an HttpHander, which works completely fine in IIS 6.0 (it's configured throught Web.Config)

   <add verb="*" path="MyHandlder" type="MyNamespace.MyHandler"/>

But when i'm trying to access it via url ( http://localhost/MyHandlder?somevar=somevalue ), it gives me "Page cannot be found" error, even thou the names are definately correct (works for IIS 6.0).

Thank you for hints.

UPD: The problem is ONLY for cases when path is without an extension. path="MyHandler.myExt" works fine. Is there ANY way to configure IIS 5.1 to handle handlers without an extension?

EDIT: Below the line is my original answer. I hadn't spotted that you said it was working for you on IIS 6... that's not been my experience in the past!

I would check your IIS 6 configuration and see if there's any special URL rewriting (or similar) set up.


Basically IIS is trying to find that as if it's a directory, because it doesn't have a file extension. I believe it treats everything without a file extension as a directory, and handles it itself - at least by default.

As annakata says in the comments, you can add "wildcard" handling via ASP.NET in IIS. This isn't something I've tried, and it sounds frankly dangerous (in terms of undesired consequences), but there are step-by-step instructions on Chris Love's blog .

Another option may be to do something with URL rewriting (not in ASP.NET, but for IIS itself), but if at all possible I'd suggest you map your handler to a path containing a file extension. If you use a file extension which isn't handled by ASP.NET already, you'll have to add that into the list of ISAPI filters.

I only know all of this because I tried to do something very similar for my Wave Robot API. You may want to look at my SO question and the answers for more information. Check the comments to the accepted answer in particular.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM