PDA

View Full Version : سوال: کار کردن با کلاس EventLog



babak1
جمعه 15 بهمن 1389, 21:03 عصر
سلام :
من برنامخ رو اجرا می کنم ولی error زیر داده میشه ؟ از ویندوز 7 استفاده می کنم چطور turn off security کنم ؟
The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.




class Program
{
static void Main(string[] args)
{
if (!EventLog.SourceExists("MySource"))
{
EventLog.CreateEventSource("MySource", "MylogEvent");
Console.WriteLine("created EventSource");
Console.WriteLine("exiting and execute the program again");

return;
}
EventLog obj = new EventLog();
obj.Source = "Mysource";
obj.WriteEntry("passage");
}

jalalx
شنبه 16 بهمن 1389, 00:53 صبح
کدوم خط خطا میده؟ من حدس میزنم حساب کاربری شما مجوز برای نوشتن توی Event Log رو نداره.

البته این راه حل رو که اینجا دیدم (http://digcode.com/default.aspx?g=posts&t=437)، هم امتحان کنید:



Start -> Run -> regedit.exe
Navigate to My Computer > HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\EventLog
Right click this key, select Permissions, and grant the ASPNET account read/write permissions as described above. Note that for the "inaccessible" logs (ie. Security, Virtual Server), you'll also need to grant read access, as permissions have been set to not inherity from the parent key.
Restart IIS (start -> Run -> iisreset)
Go in Control Panel -> Administrative Tools -> Computer Management -> Local Users and Groups
Select Administrator Group -> Right Click -> Add to Group Users "Network Service".

babak1
شنبه 16 بهمن 1389, 16:40 عصر
کدوم خط خطا میده؟ من حدس میزنم حساب کاربری شما مجوز برای نوشتن توی Event Log رو نداره.

البته این راه حل رو که اینجا دیدم (http://digcode.com/default.aspx?g=posts&t=437)، هم امتحان کنید:



Start -> Run -> regedit.exe
Navigate to My Computer > HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\EventLog
Right click this key, select Permissions, and grant the ASPNET account read/write permissions as described above. Note that for the "inaccessible" logs (ie. Security, Virtual Server), you'll also need to grant read access, as permissions have been set to not inherity from the parent key.
Restart IIS (start -> Run -> iisreset)
Go in Control Panel -> Administrative Tools -> Computer Management -> Local Users and Groups
Select Administrator Group -> Right Click -> Add to Group Users "Network Service".




"Right click this key" کدوم key ؟؟؟