相关疑难解决方法(0)

找不到源,但无法搜索部分或全部事件日志

我收到以下异常.我在Registry编辑的Eventlogs上完全控制了Asp.net帐户.

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

System.Diagnostics.EventLog.FindSourceRegistration(String source,  String machineName, Boolean readOnly, Boolean wantToCreate) +664
System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +109
System.Diagnostics.EventLog.SourceExists(String source) +14 Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() +41
Run Code Online (Sandbox Code Playgroud)

我想这是由于服务器上的一些配置问题?

.net c# securityexception event-log windows-7

122
推荐指数
5
解决办法
16万
查看次数

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

我收到错误:

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

当我在代码下运行以捕获Win 2K12 R2服务器IIS 8.5上的错误时

EventLog elog = new EventLog();
EventLog.CreateEventSource("MyApp", "Application");
EventLog.WriteEntry(Source, swError.ToString(), EventLogEntryType.Error);
Run Code Online (Sandbox Code Playgroud)

我已经完全访问HKLM\SYSTEM\CurrentControlSet\services\eventlog但它仍然没有工作.我该怎么做才能修好它?

c# iis event-log iis-8

61
推荐指数
6
解决办法
15万
查看次数

我需要更改以允许我的IIS7 ASP.Net 3.5应用程序创建事件源并将事件记录到Windows EventLog?

在IIS 7下运行的ASP.Net 3.5似乎不允许开箱即用.

        if (!EventLog.SourceExists("MyAppLog"))
            EventLog.CreateEventSource("MyAppLog", "Application");

        EventLog myLog = new EventLog();
        myLog.Source = "MyAppLog";
        myLog.WriteEntry("Message");
Run Code Online (Sandbox Code Playgroud)

asp.net permissions iis-7 event-log .net-3.5

32
推荐指数
3
解决办法
4万
查看次数

在Windows Server 2008 IIS7上写入ASP.NET中的事件日志

我正在尝试使用log4net写入Windows Server 2008 SP1上IIS7下的客户事件日志.但是,帐户似乎无权写入事件日志.有没有人有什么建议?

asp.net iis iis-7

29
推荐指数
3
解决办法
5万
查看次数

从ASP.NET MVC应用程序写入EventLog时的安全性异常

我有一个我用一些业务逻辑创建的库,包括写一个System.Diagnostics.EventLog实例.该库通常从Windows服务应用程序调用,但现在我正在尝试从我的ASP.NET MVC应用程序调用这些相同的库函数.

我在我的控制器中尝试了这个代码来创建我传递给需要写入日志的方法的EventLog实例.

Dim log = New EventLog("Application", My.Computer.Name, "MyMVCApp")
Run Code Online (Sandbox Code Playgroud)

当库方法中的代码尝试写入日志时,会生成以下错误:

[SecurityException: Requested registry access is not allowed.]
 System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
 Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7462217
 System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +366
 System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName) +194
 System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +205
 System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) +14
Run Code Online (Sandbox Code Playgroud)

我的Web应用程序在运行IIS 6的Windows Server 2003上作为网络服务用户运行.为了使网络服务用户能够访问注册表,我需要做些什么吗?

有没有更好的方法来创建一个用于ASP.NET MVC应用程序的EventLog实例?是否已经由我需要引用的框架创建了一个?

asp.net-mvc iis-6 securityexception event-log

9
推荐指数
2
解决办法
8935
查看次数

在写入事件日志时如何避免此SecurityException?

我似乎无法写入.NET中的事件日志.我得到以下异常:

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

我不想访问安全日志.我该如何解决这个错误?谢谢!

c# event-log windows-7

6
推荐指数
2
解决办法
9985
查看次数

C#Windows服务没有工作要做

我创建了一个C#windows服务,应该发送一些电子邮件,但是当我启动服务时,我收到消息'本地服务开始然后停止'......'如果他们没有工作可以自动停止某些服务'

为什么会这样?

namespace EmailService
{
public partial class EmailService : ServiceBase
{
    private System.Timers.Timer _timer = null;
    private DateTime _lastRun = DateTime.Now;
    private int _timerIntervalValue;

    public EmailService()
    {
        InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {

        if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Timer"]))
        {
            throw new Exception("The timer value is not set in the app.config.");
        }
        else
        {
            _timerIntervalValue = Convert.ToInt32(ConfigurationManager.AppSettings["Timer"]);
        }

        _timer = new System.Timers.Timer(_timerIntervalValue);
        _timer.Elapsed += OnTimedEvent;
        _timer.Interval = Convert.ToInt32(_timerIntervalValue);
        _timer.Enabled = true;

    }

    protected override void OnStop()
    {
        _timer.Stop();
        _timer.Dispose();
    }

    private …
Run Code Online (Sandbox Code Playgroud)

.net c# windows-services

3
推荐指数
1
解决办法
1274
查看次数