2009-06-12 105 views
0
  1. 如何寫日誌到Windows日誌文件? (Windows XP)Web服務和日誌文件問題

  2. 如何從Web服務中找到我的Web服務的虛擬目錄?

感謝的提前

+0

1.登錄文件或事件日誌? – Hooloovoo 2009-06-12 11:18:45

回答

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

+0

請注意,在Windows Vista或Windows Server 2008下創建事件源可能無法運行,除非您使用提升(管理員)權限運行。有關血淋淋的細節,請參閱http://stackoverflow.com/questions/712203/writing-to-an-event-log-in-asp-net-on-windows-server-2008-iis7/712214。 – 2009-06-12 12:03:32