Asp.NetMVC-SecurityException:找不到源,但无法搜索部分或全部事件日志.无法访问的日志:安全性



因此,我正在使用Visual Studio中的AWS Toolkit扩展,通过AWS Elastic Beanstalk(附带一个AWS RDS实例(部署我的网站。我的网络应用程序同时使用sensenet服务和sensenet网页组件。sensenet服务是一个强制性组件,必须存在该组件才能使用其他sensenet组件。sensnet网页组件为用户提供了一个管理GUI,这就是每当有人访问网站时显示的内容。

我的问题是每次我访问我的网站时都会发生这种安全异常(当通过localhost运行它时不会发生这种问题(。

Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 
Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 
[SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.]
System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate) +441
System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +125
System.Diagnostics.EventLog.SourceExists(String source) +23
SenseNet.Diagnostics.SnEventLogger..ctor(String logName, String logSourceName) +71
SenseNet.Configuration.<>c.<.ctor>b__153_0() in E:BuildAgent_work63ssrcStorageConfigurationProviders.cs:83
System.Lazy`1.CreateValue() +708
System.Lazy`1.LazyInitValue() +184
SenseNet.ContentRepository.RepositoryInstance.InitializeLogger() in E:BuildAgent_work63ssrcContentRepositoryRepositoryInstance.cs:350
SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:BuildAgent_work63ssrcContentRepositoryRepositoryInstance.cs:130
SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:BuildAgent_work63ssrcContentRepositoryRepositoryInstance.cs:107
SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:BuildAgent_work63ssrcContentRepositoryRepository.cs:55
SenseNet.Services.SenseNetGlobal.Application_Start(Object sender, EventArgs e, HttpApplication application) in E:BuildAgent_work63ssrcServicesSenseNetGlobal.cs:156
DERContentRepository.MvcApplication.Application_Start(Object sender, EventArgs e, HttpApplication application) in Global.asax.cs:12
SenseNet.Portal.Global.Application_Start(Object sender, EventArgs e) in E:BuildAgent_work63ssrcServicesGlobal.cs:16
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0

我读过的几篇stackoverflow帖子像一样

系统。安全写入事件日志时出现SecurityException

找不到源,但无法搜索部分或全部事件日志。无法访问的日志:安全

谈到以管理员身份运行visualstudio(这不起作用(使用应用程序的名称创建注册表项。最后一种方法我很确定它在开发中会起作用,但不确定它在部署时是否会起作用。在部署网站时如何处理这个问题有什么想法吗?

IIS Express 10

ASP。NET MVC v4.6.2

Windows Server 2016 v1.2.0

当系统启动时,它会尝试初始化记录器组件。在默认安装中,这是一个简单的事件记录器,它会尝试将事件写入Windows事件日志中,如果不存在相应的日志,则会尝试动态创建它。在某些环境中,应用程序用户对此没有(Windows(权限,这是正常的。

您有多种选择:

  • 手动创建事件日志(请参阅此处的createeventlogSnAdmin工具(
  • 使用不同的记录器将日志条目写入其他位置,而不是事件日志。例如,SnFileSystemEventLogger将条目写入文件系统。要配置记录器,您可以在MvcApplication中使用存储库生成器API:

``

public class MvcApplication : SenseNet.Portal.SenseNetGlobal
{
protected override void Application_Start(object sender, EventArgs e, HttpApplication application)
{
...
}
protected override void BuildRepository(IRepositoryBuilder repositoryBuilder)
{
repositoryBuilder.UseLogger(new SnFileSystemEventLogger());
}
}

最新更新