2017-04-18 98 views
0

我有一個網站使用EnterpriseLibrary日誌記錄塊來記錄消息。它在除一個測試環境之外的所有環境中均可正確配置並正常工作,每次網站寫入日誌消息時都會產生內部錯誤。EnterpriseLibrary日誌記錄權限錯誤

ProcessId: Unable to read intrinsic property. Error message: System.Security.Permissions.SecurityPermission 
Process Name: Unable to read intrinsic property. Error message: System.Security.Permissions.SecurityPermission 
Thread Name: 
Win32 ThreadId: Unable to read intrinsic property. | Error message: Permission for UnmanagedCode is not available. 

Microsoft.Practices.EnterpriseLibrary.LoggingHResult: -2146233078 
StackTrace Information Details: 
    at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl.GetLogicalOperationStack() 
    at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl.<>C__DisplayClass1.<Write>b__0() 

該網站具有寫入日誌目錄/文件的正確權限。什麼缺少的權限導致上述錯誤?

回答

0

EnterpriseLibrary日誌記錄需要IIS中的完全信任。在IIS管理器中,選擇頂級服務器和/或每個單獨的網站,然後在功能視圖中打開.NET信任級別。在這種情況下,信任級別被意外更改爲高,並將其更改回完全解決了錯誤。