asp.net - Web 事件提供程序 'EventLogProvider' 引发了以下异常

标签 asp.net .net iis-7 asp.net-4.0 windows-server-2008-r2

很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center .




9年前关闭。




在 Windows 2008 R2 中,我无法在 IIS 7 上运行新的 ASP.NET 4.0 应用程序。我在事件日志中只能看到以下错误。我似乎无法找到有关它的含义的任何信息,有人可以帮忙吗?

Log Name:      Application
Source:        ASP.NET 4.0.30319.0
Date:          11/27/2011 4:22:13 PM
Event ID:      1301
Task Category: Web Event
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      [myserver].[mydomain].com
Description:
The following exception was thrown by the web event provider 'EventLogProvider' in the application '/[myapp]' (in an application lifetime a maximum of one exception will be logged per provider instance):

System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
   at System.Security.Principal.WindowsIdentity.get_AuthenticationType()
   at System.Web.Management.EventLogWebEventProvider.AddWebRequestInformationDataFields(ArrayList dataFields, WebRequestInformation reqInfo)
   at System.Web.Management.EventLogWebEventProvider.ProcessEvent(WebBaseEvent eventRaised)
   at System.Web.Management.WebBaseEvent.RaiseInternal(WebBaseEvent eventRaised, ArrayList firingRuleInfos, Int32 index0, Int32 index1)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="ASP.NET 4.0.30319.0" />
    <EventID Qualifiers="49152">1301</EventID>
    <Level>2</Level>
    <Task>3</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2011-11-27T21:22:13.000000000Z" />
    <EventRecordID>1357</EventRecordID>
    <Channel>Application</Channel>
    <Computer>[myserver].[mydomain].com</Computer>
    <Security />
  </System>
  <EventData>
    <Data>EventLogProvider</Data>
    <Data>/[MyApp]</Data>
    <Data>System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
   at System.Security.Principal.WindowsIdentity.get_AuthenticationType()
   at System.Web.Management.EventLogWebEventProvider.AddWebRequestInformationDataFields(ArrayList dataFields, WebRequestInformation reqInfo)
   at System.Web.Management.EventLogWebEventProvider.ProcessEvent(WebBaseEvent eventRaised)
   at System.Web.Management.WebBaseEvent.RaiseInternal(WebBaseEvent eventRaised, ArrayList firingRuleInfos, Int32 index0, Int32 index1)</Data>
  </EventData>
</Event>

最佳答案

这是因为您的代码正在尝试写入事件日志,但运行应用程序池的用户没有此权限。

如果您无法更改应用程序池标识,您将需要更改应用程序池以作为不同用户运行或让您的网站模拟知名用户。

关于asp.net - Web 事件提供程序 'EventLogProvider' 引发了以下异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8290791/

相关文章:

iis-7 - 应用程序池标识的自定义帐户

c# - 仅使用日期时间格式比较日期和显示时间

c# - 非等待线程在 api 返回后停止执行,这是一个已知的错误,还是有人可以解释发生了什么?

ASP.NET - 从客户端访问网页两次

c# - 字符串到字典,然后再返回

visual-studio-2010 - Visual Studio 2010 - 打开不同分支时自动更新 IIS 物理路径

c# - 有什么方法可以使电子邮件的主题加粗吗?

.net - MEF 导入在 Windows 服务中失败

.net - .NET Framework 4.6、.Net Native 和 .Net Core 之间的区别

IIS 提供的 CSS 呈现方式不同