接手一个项目,发现部署后一直报错:
“/DynamicService”应用程序中的服务器错误。
拒绝访问。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ComponentModel.Win32Exception: 拒绝访问。
源错误:
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[Win32Exception (0x80004005): 拒绝访问。]
[InvalidOperationException: 无法打开源“abc”的日志。您可能不具有写访问权。]
System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName) +2406365
System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) +360
System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +443
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) +30
LogisticsPlatform.Conveyance.DynamicService.Init.Page_Load(Object sender, EventArgs e) +111
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18446
解决过程:
参考下面的这篇KB没解决
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B329291
修改应用程序池的用户标识,localService, localSystem, admin都试过,不行
修改IIS,禁止匿名登录,在登录框使用管理员登录,就能执行通过。
最后修改匿名登录凭据配置,把原来的IUSR用户改为应用程序池标识(那边用ApplicationPoolIdentity ),问题解决。