Exception handling 无法打开源';Microsoft.Practices.EnterpriseLibrary.Data';。读/写事件日志时,您可能没有写权限

Exception handling 无法打开源';Microsoft.Practices.EnterpriseLibrary.Data';。读/写事件日志时,您可能没有写权限,exception-handling,sharepoint-2013,event-log,windows-server-2012,securityexception,Exception Handling,Sharepoint 2013,Event Log,Windows Server 2012,Securityexception,我在SharePoint 2013网站上工作,我有两种注册类型:(Win认证和FBA)。 我正在尝试使用旧门户(SP 2010)中的解决方案(WSP),此WSP使用名为“Microsoft.Practices.EnterpriseLibrary.Data”的dll,该dll在SP 2013环境中不存在。 为了解决这个问题,我从Microsoft安装了Microsoft企业库5.0,然后将此dll复制到inetpub\wwwroot\wss\VirtualDirectories\80\ 现在,当我

我在SharePoint 2013网站上工作,我有两种注册类型:(Win认证和FBA)。
我正在尝试使用旧门户(SP 2010)中的解决方案(WSP),此WSP使用名为“Microsoft.Practices.EnterpriseLibrary.Data”的dll,该dll在SP 2013环境中不存在。

为了解决这个问题,我从Microsoft安装了Microsoft企业库5.0,然后将此dll复制到inetpub\wwwroot\wss\VirtualDirectories\80\

现在,当我使用windows身份验证模式登录到站点时,会出现Web部件,但当以FBA用户身份登录时,会出现错误:

System.InvalidOperationException: Cannot open log for source 'Microsoft.Practices.EnterpriseLibrary.Data'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied
   --- End of inner exception stack trace ---
   at System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName)
   at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
   at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type)
   at ProjectName.Internet.EventViewerLogService.LogEvent(String source, String message, EventLogEntryType type)
   at ProjectName.Internet.ExceptionHandler.Handle(Exception exception)
   at ProjectName.Internet.SQLHelper.GetVolunteerInfo(String VolunteerId)
   at ProjectName.Internet.Profiles.Volunteer.GetVolunteer(String VolunteerId)
   at ProjectName.Internet.Accessibility.Accessibility.AccessibilityUserControl.Page_Load(Object sender, EventArgs e)

注意:我试图将“安全性”的权限授予注册表HKEY\U LOCAL\U MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security给“Authenticated Users group”,因为我在开始时出错 错误:找不到源,但无法搜索部分或所有事件日志。无法访问的日志:安全性

附言:这是一个后续行动。我按照给出的答案去做,但没有结果。


我猜这是由于服务器上的某些配置问题造成的?

该错误与权限问题有关,当我使用FBA用户登录时,我错过了写入新事件源的权限

默认情况下,任何经过身份验证的用户都可以写入应用程序事件日志。但是,只有管理员才能创建新的事件源

我通过使用提升的权限运行CreateEventSource方法来解决此问题,如下所示:

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                if (!EventLog.SourceExists(eSource))
                {
                    EventLog.CreateEventSource(eSource, eLog);
                }
                EventLog.WriteEntry(eSource, ex.ToString(), EventLogEntryType.Error);
            });