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 日志


基础教程推荐
- 如何激活MC67中的红灯 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30