【发布时间】:2015-09-02 14:48:10
【问题描述】:
我正在尝试为 sql 数据库中的表值函数创建一个 odata 端点。我认为我的代码很好,但一些设置问题导致我收到错误:
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
我无法找出错误的来源。不同项目中的相同代码正在运行,并且之前也已经过测试。
【问题讨论】:
标签: c# .net visual-studio asp.net-web-api odata