Reputation: 977
So I'm deploying my website through AWS Elastic Beanstalk(with an AWS RDS instance attached to it) using the AWS Toolkit Extension in Visual Studio. My web app is using both the sensenet service and sensenet webpages component. The sensenet services is a mandatory component that must exist for other sensenet components to be used. The sensnet webpages component provides an admin GUI for the user and this is what gets displayed whenever someone visits the site.
My problem is this security exception that occurs every time I go to my website(This problem doesn't occur when run it through 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\_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
A couple of stackoverflow posts that I've read like these
System.Security.SecurityException when writing to Event Log
talked about running visual studio as administrator(this did not work) and creating a registry key with the name of the application. The last approach I'm pretty sure it would work in development but not sure if it would work when deploying. Any ideas how to deal with this when deploying the website?
IIS Express 10
ASP.NET MVC v4.6.2
Windows Server 2016 v1.2.0
Upvotes: 1
Views: 3897
Reputation: 1511
When the system starts it tries to initialize the logger component. In the default installation this is a simple event logger that tries to write events into the Windows Event Log - and if the appropriate log does not exist, it tries to create it on-the-fly. In some environments the application user does not have (Windows) permissions for this, which is normal.
You have multiple options:
```
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());
}
}
Upvotes: 2