WebService调用时创建应用程序事件日志时出现异常的解决方法

最近在进行老项目.net1.1升级到.net4.5的工作,升级WebService的时候,出现了下了内容中的异常。

 1 System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.Security.SecurityException: The event source ExceptionManagerInternalException does not exist and cannot be created with the current permissions. ---> System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。 不可访问的日志: Security。
 2 在 System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate)
 3 在 System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate)
 4 在 System.Diagnostics.EventLog.SourceExists(String source)
 5 在 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() 位置 d:\UJS2.0\PrceduLMS\SystemFramwork\Microsoft.ApplicationBlocks.ExceptionManagement\ExceptionManager.cs:行号 659
 6 --- 内部异常堆栈跟踪的结尾 ---
 7 在 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() 位置 d:\UJS2.0\PrceduLMS\SystemFramwork\Microsoft.ApplicationBlocks.ExceptionManagement\ExceptionManager.cs:行号 666
 8 在 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.Publish(Exception exception, NameValueCollection additionalInfo, NameValueCollection configSettings) 位置 d:\UJS2.0\PrceduLMS\SystemFramwork\Microsoft.ApplicationBlocks.ExceptionManagement\ExceptionManager.cs:行号 535
 9 在 Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.PublishInternalException(Exception exception, NameValueCollection additionalInfo) 位置 d:\UJS2.0\PrceduLMS\SystemFramwork\Microsoft.ApplicationBlocks.ExceptionManagement\ExceptionManager.cs:行号 301
10 在 Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(Exception exception, NameValueCollection additionalInfo) 位置 d:\UJS2.0\PrceduLMS\SystemFramwork\Microsoft.ApplicationBlocks.ExceptionManagement\ExceptionManager.cs:行号 229
11 在 Prcedu.Solutions.Dedu.LMS.SystemFramwork.LMSAppExceptionAdmin.ExceptionManager.Publish(Exception ex, NameValueCollection addInfo)
12 在 Prcedu.Solutions.Dedu.LMS.DEEWebService.ADModify.ModifyADPassword(String strUserName, String strPassword, String& strMessage)
13 --- 内部异常堆栈跟踪的结尾 ---

经过查看堆栈跟踪信息后发现,该问题出现在System.Diagnostics.EventLog类中,该类为本地计算机的事件日志操作类。此脚本 执行时候需要使用管理员权限才能正确执行。

 

解决方式为,在站点的Web.Config文件中<system.web></system.web>内添加节点及值即可。

<identity impersonate="true" userName="管理员账号" password="管理员密码"/>

 

posted on 2017-02-23 19:21  LoveCss  阅读(1340)  评论(0编辑  收藏  举报

导航