在 Windows Server 2003R2 上使用日志记录应用程序块 (EntLib 5) 时遇到问题

发布于 2024-09-10 08:27:39 字数 298 浏览 2 评论 0原文

典型场景是,我使用 EntLib 5.0-2010 年 4 月登录我的开发机器,一切都像魅力一样工作,当我尝试在我们的 Web 服务器上投入生产时,它不起作用。

开发机是Windows 7,使用VS2008。 生产服务器是 Windows Server 2003 R2,带有 Microsoft .NET Framework 3.5 Service Pack 1。

我将 LAB DLL 包含在项目中(Common、Logging、ServiceLocation),而不是包含在 GAC 中。

有什么想法吗?

提前致谢

Typical scenario, I am using EntLib 5.0-April 2010 Logging on my development machine and everything works like a charm, when I try to put in production on our web server, it does not work.

Development machine is Windows 7 using VS2008.
Production server is Windows Server 2003 R2 with Microsoft .NET Framework 3.5 with Service Pack 1.

I am including the LAB DLLs in the project (Common, Logging, ServiceLocation), not in the GAC.

Any ideas?

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笨死的猪 2024-09-17 08:27:39

事实证明,由于我是从 VS 以管理员身份运行 Web 应用程序,所以 LogSource 是为我创建的。在生产中,应用程序以正常权限运行,并需要管理员创建 LogSource。查看以下内容:

http ://entlib.codeplex.com/wikipage?title=为什么%20are%20messages%20not%20logged?&referringTitle=EntLib%20FAQ

It turns out that since I was running the web app from VS run as an administrator, the LogSource is created for me. When in production, the app is run with normal privileges and requires the LogSource to be created by an admin. Check out the following:

http://entlib.codeplex.com/wikipage?title=Why%20are%20messages%20not%20logged?&referringTitle=EntLib%20FAQ

趁微风不噪 2024-09-17 08:27:39

创建一个控制台应用程序并写入以下行:

 class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.EventLog.CreateEventSource("Enterprise Library Logging", "Application");
            System.Diagnostics.EventLog.WriteEntry("Application", "Sample error", System.Diagnostics.EventLogEntryType.Error);
        }
    }

将 exe 文件复制到服务器,并以管理员身份运行它。然后,在事件查看器中,您将看到消息“示例错误”以确保这些行已执行。

它会解决你的问题。

Create a console application and write these lines:

 class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.EventLog.CreateEventSource("Enterprise Library Logging", "Application");
            System.Diagnostics.EventLog.WriteEntry("Application", "Sample error", System.Diagnostics.EventLogEntryType.Error);
        }
    }

Copy the exe file to the Server , and run it as Administrator. Then , in Event Viewer, you'll see the message "Sample error" to ensure the lines were executed.

It will solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文