It is probably a Windows-based security error (UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create event
sources or check to see if they exist. It can only write to them.
Normally I solve this problem by creating the event log at install time
using Administrator privileges. You can also elevate the privileges of the
ASP.NET account, but that isn't a good idea, especially if this is the only
reason you need to do that.
Also, if you are on Win2K3, there are some issues with creating custom event
logs as well. If that applies to you, you might want to search this group
or MS support for more info.
Joe K.
> I haven't had to deal with the security stuff before now, and I can't seem
> to get started. I have a web service, and I want to log to the event log.
[quoted text clipped - 8 lines]
>
> Thanks
Michael Bird - 22 Jun 2004 16:39 GMT
Actually, it is a SecurityException; and even if I put the IUSR and IWAM
accounts into the Administrators group just to check, I still get the
exception.
"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
> It is probably a Windows-based security error (UnauthorizedAccessException)
> instead of a .NET Code Access Security problem (SecurityException).
[quoted text clipped - 26 lines]
> >
> > Thanks
Joe Kaplan \(MVP - ADSI\) - 22 Jun 2004 19:27 GMT
Strike one for Kaplan! The error you are getting is not the more common
scenario then.
Is the web application configured to run in partial trust mode? Is there
anything in the securityPolicy element in web.config?
Typically, web applications run with Full Trust, so CAS doesn't enter into
the picture, but it sounds like that is not the case here.
The config element may be up the chain in one of the higher level web.config
files or in machine.config.
Joe K.
> Actually, it is a SecurityException; and even if I put the IUSR and IWAM
> accounts into the Administrators group just to check, I still get the
[quoted text clipped - 38 lines]
> > >
> > > Thanks
Michael Bird - 23 Jun 2004 21:42 GMT
Your first suggestion of fixing the problem by creating the event log source
ahead of time did the trick. Thanks for that one. Now I still need to
better understand how code-access security works and where the limit to not
allow the code to write to the registry was coming from since it wasn't the
trust on the code or the user account priveleges...
"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
> Strike one for Kaplan! The error you are getting is not the more common
> scenario then.
[quoted text clipped - 54 lines]
> > > >
> > > > Thanks
Joe Kaplan \(MVP - ADSI\) - 23 Jun 2004 23:23 GMT
Glad that worked. I'm still confused about what the actual problem was too.
You said it was a SecurityException which leads me to believe it was a CAS
problem (partial trust), but that isn't clear it was the case. Maybe
someone else will chime in.
Joe K.
> Your first suggestion of fixing the problem by creating the event log source
> ahead of time did the trick. Thanks for that one. Now I still need to
[quoted text clipped - 68 lines]
> > > > >
> > > > > Thanks