[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

writing to the windows event log

Posted on 2004-11-12
15
Medium Priority
?
527 Views
Last Modified: 2012-06-27
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!
0
Comment
Question by:jrmcdona
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 6

Expert Comment

by:ryerras
ID: 12571698
Which event log you are writing? Custom log or?
0
 

Author Comment

by:jrmcdona
ID: 12571702
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
 
LVL 6

Expert Comment

by:ryerras
ID: 12571728
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jrmcdona
ID: 12575096
Thanks for the help. However, we are using the Exception block. So I am trying to get things to work with that first.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12576599
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
 
LVL 20

Accepted Solution

by:
ihenry earned 2000 total points
ID: 12578048

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
 

Author Comment

by:jrmcdona
ID: 12579164
ihenry, yes that is what I am doing.

does intsalling the dll using installutil solve this problem?

thanks
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12579199
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
 

Author Comment

by:jrmcdona
ID: 12579221
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
 
LVL 20

Expert Comment

by:ihenry
ID: 12579274
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
 
LVL 20

Expert Comment

by:ihenry
ID: 12579313
One more question,
are you trying to write to event log on a remote machine?
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12579356
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
 
LVL 20

Expert Comment

by:ihenry
ID: 12584473

Hi jrmcdona
Hows the problem so far?
0
 

Author Comment

by:jrmcdona
ID: 12586179
I am tackling it right now. I will let you know, but I think it is the permissions like you said. thanks.
0
 

Author Comment

by:jrmcdona
ID: 12588695
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question