By default the ASPNET account under which ASP.NET applications cannot write to the registry. So if you are writing an event log entry with a new source it will fail.
The simple answer is to run regedit and go to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application
Then create a new key with the name of your event source.
Full details can be found here.
Fixing Common Pitfalls of Codemods
2 days ago