Web服务和日志文件问题

时间:2009-06-12 11:16:08

标签: c# web-services

  1. 如何将日志写入Windows日志文件? (Windows XP)

  2. 如何查找我的Web服务的虚拟目录(来自Web服务)?

  3. 提前谢谢

1 个答案:

答案 0 :(得分:1)

写入事件日志:

System.Diagnostics.EventLog.CreateEventSource(strMyApp, "Application");
EventLog MyEventLog = new EventLog();
MyEventLog.Source = strMyApp;
MyEventLog.WriteEntry(strEvent, EventLogEntryType.Warning);

查找虚拟目录:

http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx