A: 

I believe that under IIS7 (which I am assuming you are using) the application pool will be running under NETWORK SERVICE.

You could try giving NETWORK SERVICE Full Control to the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application.
(Not Recommended!)

Alternatively, you could grant EVERYONE Full control to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application, log a message, then revert that change. Once the key is set up then you won't need the permissions to write to the registry.

Or you could manually configure the registry keys that you require beforehand to avoid the permission problems:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\Logger]
"EventMessageFile"="c:\\WINNT\\Microsoft.NET\\Framework\\v2.0.50727\\EventLogMessages.dll"


Tuzo
I think it is a bad idea to give network service full access to Registry.
Costa
Yes. I agree with you -- not recommended.
Tuzo
A: 

I use a PowerShell script to create the appropriate source ...

$source = "FoToIaW"
if ([System.Diagnostics.EventLog]::SourceExists($source) -eq $false) 
{
  [System.Diagnostics.EventLog]::CreateEventSource($source, "Application")
}
SteveC