write to IIS log from an ASP.NET application(从 ASP.NET 应用程序写入 IIS 日志)
问题描述
我想让我的 ASP.NET 应用程序在某处将行写入日志.IIS 是否提供任何内置方式来记录 ASP.NET 日志消息?我在想可能有一种方法可以捕获对 System.Diagnostics.Debug.WriteLine() 的调用,但我找不到任何方法.
I want to have my ASP.NET application write lines to a log somewhere. Does IIS provide any built-in way to log ASP.NET log messages? I was thinking there might be a way to capture calls to System.Diagnostics.Debug.WriteLine(), but I can't find any way to do it.
推荐答案
要捕获 Debug.Write
和 Debug.WriteLine
使用 DebugView 来自 sysinternals.
To capture the Debug.Write
and Debug.WriteLine
use the DebugView from sysinternals.
http://technet.microsoft.com/en-us/sysinternals/bb896647
当然你必须用 Debug=true
编译,否则函数根本不会被调用.因此,Debug.Write 是一种仅用于实时测试和调试您的应用程序的好方法,而不是一般记录错误的解决方案.对于您希望保存错误的情况,我认为您需要使用其他用户建议的一个库,或者直接在事件查看器上写下您的错误.
Of course you have to compile with Debug=true
or else the functions is not called at all. So the Debug.Write is a good way only for test in real time and debug your application and not a solution to keep log on the errors in general. For the case that you like to save the errors I think that you need to ether use one library of the other user suggestions, or write direct on event viewer your errors.
ps:由于某种原因,4.78 版无法在我的 windows xp 上运行,我切换回 4.77
这篇关于从 ASP.NET 应用程序写入 IIS 日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 ASP.NET 应用程序写入 IIS 日志


基础教程推荐
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01