我花了一天的時間嘗試進行Ent Lib日誌記錄工作並將任何內容記錄到數據庫或事件日誌中。我有一個具有相同的Ent Lib配置的Web應用程序和控制檯應用程序,但只有控制檯應用程序能夠登錄到事件日誌。我嘗試了一切權限,但我不知道我在做什麼—哪些服務應該有什麼。這是行不通的!企業庫日誌記錄沒有從ASP.NET登錄到事件日誌
我看過這樣的文章 http://imar.spaanjaars.com/275/logging-errors-to-the-event-log-in-aspnet-applications 我想嘗試給ASPNET帳戶這些權限。我正在使用Windows 7,並且找不到ASPNET用戶帳戶。那麼它在哪裏?
這是自動從耳鼻喉科庫實用程序生成的配置文件和
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true"
revertImpersonation="false">
<listeners>
<add source="Logger" formatter="Text Formatter" log="Application"
machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Formatted EventLog TraceListener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
你能發佈你配置的相關部分嗎? WebApp和ConsoleApp是否在同一臺機器上運行? – RoelF 2010-06-03 12:30:25
是的,WebApp和ConsolApp在同一臺機器上運行 – Costa 2010-06-03 12:45:16
「我嘗試了所有權限」 - 您嘗試了什麼? – 2010-06-03 15:51:52