因此,我正在使用Visual Studio中的AWS Toolkit扩展程序通过AWS Elastic Beanstalk(附加了AWS RDS实例)部署网站。我的Web应用程序同时使用了Sensenet服务和Sensenet网页组件。感知网络服务是必不可少的组件,必须使用其他感知网络组件。 sensnet网页组件为用户提供了一个管理GUI,只要有人访问该网站,就会显示该内容。
我的问题是每次我访问网站时都会发生此安全异常(通过本地主机运行该问题不会发生)。
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\_work\63\s\src\Storage\Configuration\Providers.cs:83
System.Lazy`1.CreateValue() +708
System.Lazy`1.LazyInitValue() +184
SenseNet.ContentRepository.RepositoryInstance.InitializeLogger() in E:\BuildAgent\_work\63\s\src\ContentRepository\RepositoryInstance.cs:350
SenseNet.ContentRepository.RepositoryInstance.DoStart() in E:\BuildAgent\_work\63\s\src\ContentRepository\RepositoryInstance.cs:130
SenseNet.ContentRepository.RepositoryInstance.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\63\s\src\ContentRepository\RepositoryInstance.cs:107
SenseNet.ContentRepository.Repository.Start(RepositoryStartSettings settings) in E:\BuildAgent\_work\63\s\src\ContentRepository\Repository.cs:55
SenseNet.Services.SenseNetGlobal.Application_Start(Object sender, EventArgs e, HttpApplication application) in E:\BuildAgent\_work\63\s\src\Services\SenseNetGlobal.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\_work\63\s\src\Services\Global.cs:16
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0
我已经读过一些这样的stackoverflow帖子
System.Security.SecurityException when writing to Event Log
谈到了以管理员身份运行Visual Studio(这不起作用),并且 使用应用程序名称创建注册表项。我很确定最后一种方法可以在开发中使用,但不确定在部署时是否可以使用。有什么想法在部署网站时如何处理?
IIS Express 10
ASP.NET MVC v4.6.2
Windows Server 2016 v1.2.0
答案 0 :(得分:2)
系统启动时,它将尝试初始化记录器组件。在默认安装中,这是一个简单的事件记录器,尝试将事件写入 Windows事件日志-如果不存在适当的日志,它会尝试即时创建它。在某些环境中,应用程序用户对此没有权限(Windows),这是正常的。
您有多种选择:
```
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());
}
}