Elmah 不支持 asp.net mvc
我花了无数的时间试图让 Elmah 使用 asp.net mvc,但无法让它 100% 工作。现在所有的日志记录都工作正常,但是 HttpHandler 却很奇怪。每次我尝试登录管理员帐户时,我都会自动重定向到 Elmahs 列表页面。
这是没有意义的,因为 elmah 的路径只是 elmah.axd (这就是我在 web.config 中用于 httphandler 的路径),而我的管理路径类似于 /MyAdmin/login,所以我看不到连接。我还在我的路由表中为 elmah 设置了忽略路由。 \
总结一下。
Elmah 日志记录有效,错误显示页面也有效。当我尝试登录我的管理员帐户时,它会自动重定向到 Elmahs 错误显示页面。我不知道为什么。
- 如果我注释掉
routes.IgnoreRoute("elmah.axd");
我的登录有效。如果我把它留在那里,它总是重定向到 elmah。
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.IgnoreRoute("elmah.axd");
my login works. IF I leave it in there it always redirects to elmah.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我终于想通了。没有人会得到这个...我有一个对 RouteDebugger.dll 的引用,它是我从《Asp.net MVC Framework Unleashed》一书中获得的,并且由于某种原因,如果启用了 Elmah,这个 dll 会搞乱我的所有发布请求。
我想通了这纯粹是运气。我无法让 RouteDebugger 工作,因此我删除了引用并添加了另一个引用,然后一切正常。
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.
谷歌做了一个完整的演练...
将您的设置与他们的设置相匹配...
我不懂 elmah 但能够做到。
http://code.google.com/p/elmah/wiki/MVC
-马克
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
猜测了一下,但是您可以尝试使用 路由调试器< /a> 看看是否有问题命中正确的路线?
另外,IgnoreRoute 调用是否在所有 MapRoute 调用之前?
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?
在 FIDDLER 上观察流量。它应该为您提供一些有关正在发生的事情的线索。
Watch the traffic on FIDDLER. It should give you some clues as to what's going on.
我认为这是设置它的更新版本,飓风指出的是早期版本:http://code.google.com/p/elmah/wiki/DotNetSlackersArticle
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