writing to the windows event log

Does the aspnet_worker need permissions to write to the event log.

I am using the default Publisher in the Microsoft Exception block and it is failing to write to the event log.

Anybody done this before?

Thanks!
jrmcdonaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ryerrasCommented:
Which event log you are writing? Custom log or?
0
jrmcdonaAuthor Commented:
I am trying to do either or. It would be nice to create my own log and write to it.

But if not, writing to the system log would do as well...

thanks!
0
ryerrasCommented:
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

jrmcdonaAuthor Commented:
Thanks for the help. However, we are using the Exception block. So I am trying to get things to work with that first.
0
AerosSagaCommented:
I have done this, but I use this little app I found don't know where to create the log first, heres the code, just in case it helps

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    'Fires when an error occurs
    Dim strErrorDescription As String = Server.GetLastError.GetBaseException.ToString
    Dim evtCEDA As New EventLog
    strErrorDescription += ControlChars.CrLf & ControlChars.CrLf
    evtCEDA.Log = "CyToys"
    evtCEDA.WriteEntry("CyToys", strErrorDescription, EventLogEntryType.Error)
End Sub

Aeros
0
ihenryCommented:

Are you using EMAB directly in ASP.NET application? if yes you might hit to Security Exception when you try to verify if an event source exists or create a new event source (take a look at the VerifyValidSource() method under DefaultPublisher class). This is due to the lack of permission rights for ASPNET or NETWORK SERVICE (Win 2003) user account to do such actions.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jrmcdonaAuthor Commented:
ihenry, yes that is what I am doing.

does intsalling the dll using installutil solve this problem?

thanks
0
ihenryCommented:
You mean install from the exception management msi? Can you elaborate more on the "failing to write to the event log"? or do you see error any message message?
0
jrmcdonaAuthor Commented:
What i mean by failing is that it isnt creating the event log and writing the event and i am fairly sure it because of the permissions.

How do i go about setting the permissions for the ASPNET or NETWORK SERVICE (Win 2003) user accounts to be able to create event log and write to the log?

thanks

0
ihenryCommented:
In general, ASPNET or NETWORK SERVICE user should has permission to write to Application event log (not Security or System event log). But it can't create a new event log or event source. If you think to grant proper permissions to ASPNET or NETWORK SERVICE user account or enable impersonation, without your app has other requirement to do so I don't think it's necessary.

One better solution would be to install the event source in the machines before running the EMAB and make sure you don't have code which make a call to the VerifyValidSource() method should be enough for you to get rid from the problem.
0
ihenryCommented:
One more question,
are you trying to write to event log on a remote machine?
0
ihenryCommented:
Ok, I think I understand what you mean by "using installutil". My answer is yes, it could help. Just create a class which has necessary code to create a new event source, compile and execute using InstallUtil.exe.
0
ihenryCommented:

Hi jrmcdona
Hows the problem so far?
0
jrmcdonaAuthor Commented:
I am tackling it right now. I will let you know, but I think it is the permissions like you said. thanks.
0
jrmcdonaAuthor Commented:
I got this working. I did the installutil.exe and also we were in the middle of changing over to impersonation. I think either or of those would give the correct permissions! It works now using the EMAB.

thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.