在中等信任度中使用 ELMAH
我正在构建一个 ASP.net mvc 应用程序,在使用 xml 日志记录到中等信任服务器部署 ELMAH 时遇到一些问题,尽管它在我的本地计算机上运行良好。它不断收到 404 错误。
问题可能是主机不允许相对文件路径,因此“~/App_Data”不适用于日志记录。我将其切换为:
logPath="\\Something\Something\ID\www.website.com\web\content\App_Data"
在 web.config 中。语法可能完全错误,但我尝试了一些变体,但没有一个起作用。
我随后发现 这个问题 并将推荐的代码添加到我的 web.config 中,但仍然没有运气。有谁知道如何让 ELMAH 在中等信任度上工作?
谢谢!
I'm building an ASP.net mvc app, and am having some problems getting ELMAH deployed using xml logging to a medium trust server, though it works fine on my local machine. It keeps getting a 404 error.
The problem might be that the host doesn't allow relative filepaths, so the "~/App_Data" doesn't work for logging. I switched that to:
logPath="\\Something\Something\ID\www.website.com\web\content\App_Data"
in the web.config. The syntax might be completely off, but I've tried a few variations and none of them worked.
I subsequently found this question and added the recommended code to my web.config, but still no luck. Does anyone know how to get ELMAH to work on medium trust?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
asp.net 工作进程(或 aspnet 用户)具有写入文件系统的最低权限。尝试像 c:\temp 这样每个人都可以写入文件的地方。之后检查并设置 aspnet 用户的访问权限。
The asp.net worker process (or the aspnet user) has minimum rights to write into the filesystem. Try a place like c:\temp where everybody can write files. After this check and set access rights for aspnet user.
事实证明,ELMAH.dll 正在调用 SQLite,这在中等信任度下是不允许的,并导致 ELMAH 在部署到中等信任度时失败。我需要下载 ELMAH 的源代码并在不引用 SQLite 的情况下重新构建它。现在正在工作。耶!
It turned out that the ELMAH.dll was calling SQLite, which isn't allowed under medium trust, and was causing ELMAH to fail when deployed to medium trust. I needed to download the source code for ELMAH and re-build it without the reference to SQLite. It is now working. Yay!