Reputation: 41
I have made an MVC application where I use following line in one of the method:
EventLog ev = new EventLog();
It works fine on local but when I tried to run it on server, this line gave me following error:
Request for the permission of type 'System.Diagnostics.EventLogPermission,System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I am not able to understand the issue, can anyone please help me with it?
Upvotes: 0
Views: 688
Reputation: 684
You may need to simply ask for the correct security permissions prior to using the Event log, like so:
EventLogPermission eventLogPermission = new EventLogPermission(EventLogPermissionAccess.Administer, ".");
eventLogPermission.PermitOnly();
See here: support.microsoft.com bug article
Upvotes: 1