BIDeveloper
BIDeveloper

Reputation: 2638

Cannot open log for source 'blah'. You may not have write access. Eh?

I'm, attempting to write to a custom event log .... but I get the error:

Win32Exception Access Is Denied Cannot open log for source 'blah'. You may not have write access.

I've trawled the net.. followed varions links and to date the best one I've come across is this one. It's not as clear as it could be though....

This is a 2008 R2 development server. I've added the following REG_SZ key "CustomSD" with a value of O:BAG:SYD:(A;; 0x7;;;AN)(A;; 0x7;;;SY)(A;; 0x7;;;BA)(A;; 0x7;;;SO)(A;; 0x7;;;IU)(A;; 0x7;;;SU)

to registry folders "eventlog" and my sub folders.

I've also allowed everyone full access to the physical event log (.evtx file)... but all to no avail...

I think I'm giving Read Write and Clear access to the various account types (SY=System etc,).

My website which fails is running under the default IISAPPPool account.

Anyone any ideas?

Thanks in advance,

Jim

Upvotes: 2

Views: 8952

Answers (1)

John Saunders
John Saunders

Reputation: 161831

ASP.NET runs in a reduced trust environment.

If your event log source does not already exist, then registry keys will have to be added in order to create it.

But that won't work in the reduced-trust environment.

You should create an installer class for the event source you're using, then "install" the web site during deployment. The fastest way to do this is to create a "Component" to do your event logging, drag an Event Log component onto the design surface, set the properties, then choose the command to create an installer.

At deployment time, you'll just have to run "installutil" against your web application's DLL. The event source will be created before your web application starts.

Upvotes: 1

Related Questions