Elmah does not work with asp.net mvc
I spent countless hours trying to get Elmah working with asp.net mvc, but can't get it working 100%. Right now all the logging works fine, but the HttpHandlers are all screwy. Everytime I try and log into an admin account I automatically get redirected to Elmahs listings page.
It makes no sense because the path for elmah is just elmah.axd (that's what I use for the httphandler in the web.config) and my admin path is something like /MyAdmin/login, so I don't see the connection. I have also setup the ignore routes thing in my routes table for elmah. \
To sum it up.
Elmah logging works and so does the error display pages. When I try and log in to my admin account it automatically redirect to Elmahs error display page. I have no idea why.
- If I comment out
routes.I开发者_如何学JAVAgnoreRoute("elmah.axd");
my login works. IF I leave it in there it always redirects to elmah.
I finally figured it out. No one would have got this one... I had a reference to RouteDebugger.dll which I got from the book "Asp.net MVC Framework Unleashed" and for some reason this dll messed up all my post requests if Elmah was enabled.
It was pure dumb luck that I figured it out. I couldn't get the RouteDebugger working so I deleted the reference and added a different one and then everything worked.
Google did a whole walk-through...
match your settings to theirs...
I didn't understand elmah and was able to do it.
http://code.google.com/p/elmah/wiki/MVC
-Mark
Guessing a bit, but can you try to use the Route Debugger to see if there is a problem hitting the correct route?
Also, is the IgnoreRoute call BEFORE all MapRoute calls?
Watch the traffic on FIDDLER. It should give you some clues as to what's going on.
I think this is the updated version for setting it up, the one Hurricane pointed to was for earlier versions: http://code.google.com/p/elmah/wiki/DotNetSlackersArticle
精彩评论