Reputation: 436
I am trying to create an odata endpoint for a table valued function in sql database. I think my code is fine but some settings issue is causing me get the error :
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. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.
Source Error:
Line 12: {
Line 13: eventLog.Source = source;
Line 14: eventLog.WriteEntry(
Line 15: message,
Line 16: type,
Source File: c:\Users\novak\Desktop\Latest\PAIntelODataService\Common\Logging\LogHelper.cs Line: 14
Stack Trace:
[SecurityException: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.]
System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate) +657
System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +104
System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName) +86
System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +201
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category) +25
ODataService.Common.<WriteToEventLog>d__0.MoveNext() in c:\Users\novak\Desktop\Latest\PAIntelODataService\Common\Logging\LogHelper.cs:14
System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__4(Object state) +50
System.Web.<>c__DisplayClass7.<Post>b__6() +15
System.Web.Util.SynchronizationHelper.SafeWrapCallback(Action action) +90
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248
I cannot figure out the source of the error. The same code in a different project is working and has been tested previously too.
Upvotes: 0
Views: 536
Reputation:
Make the application publish folder Shared
with read\write
allow for everyone
.
This is just because the application tries to write a log while it is not having the proper permission
Upvotes: 1