473,508 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Events using System.Diagnostics.EventLog...

I am able to create new sources using CreateEventSource.
I can call GetEventLogs, I can delete sources, I can see
if sources exist BUT, as soon as I try a "WriteEntry", I
get an exception:

{System.InvalidOperationException}
[System.InvalidOperationException]:
{System.InvalidOperationException}
HelpLink: Nothing
InnerException: {System.ComponentModel.Win32Exception}
Message: "Cannot open log for source {0}. You may not
have write access."
Source: "System"
StackTrace: " at
System.Diagnostics.EventLog.OpenForWrite()
at System.Diagnostics.EventLog.WriteEvent(Int32
eventID, Int16 category, EventLogEntryType type, String[]
strings, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID)
at FormRouter.Global.LogError(String sError) in
c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
TargetSite: {System.Reflection.RuntimeMethodInfo}

The inner exception is:
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
HelpLink: Nothing
InnerException: Nothing
Message: "Access is denied"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing


I don't quite understand. I am running .NET v.1.1.4322.
I am developing using VS .NET 2003. I am running Windows
2003 Server Enterprise.
Nov 18 '05 #1
5 4009
What account is your app running under? What are the permissions for this
account?

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David Conorozzo" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I am able to create new sources using CreateEventSource.
I can call GetEventLogs, I can delete sources, I can see
if sources exist BUT, as soon as I try a "WriteEntry", I
get an exception:

{System.InvalidOperationException}
[System.InvalidOperationException]:
{System.InvalidOperationException}
HelpLink: Nothing
InnerException: {System.ComponentModel.Win32Exception}
Message: "Cannot open log for source {0}. You may not
have write access."
Source: "System"
StackTrace: " at
System.Diagnostics.EventLog.OpenForWrite()
at System.Diagnostics.EventLog.WriteEvent(Int32
eventID, Int16 category, EventLogEntryType type, String[]
strings, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID)
at FormRouter.Global.LogError(String sError) in
c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
TargetSite: {System.Reflection.RuntimeMethodInfo}

The inner exception is:
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
HelpLink: Nothing
InnerException: Nothing
Message: "Access is denied"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing


I don't quite understand. I am running .NET v.1.1.4322.
I am developing using VS .NET 2003. I am running Windows
2003 Server Enterprise.

Nov 18 '05 #2
Kevin, we're having the same problem here. The ASP.NET application,
currently installed on Windows 2003 Server, used to work fine on
Windows 2000.

We've set the Impersonate parameter to TRUE.

"Kevin Spencer" <ke***@takempis.com> wrote in message news:<OU**************@TK2MSFTNGP10.phx.gbl>...
What account is your app running under? What are the permissions for this
account?

--
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David Conorozzo" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I am able to create new sources using CreateEventSource.
I can call GetEventLogs, I can delete sources, I can see
if sources exist BUT, as soon as I try a "WriteEntry", I
get an exception:

{System.InvalidOperationException}
[System.InvalidOperationException]:
{System.InvalidOperationException}
HelpLink: Nothing
InnerException: {System.ComponentModel.Win32Exception}
Message: "Cannot open log for source {0}. You may not
have write access."
Source: "System"
StackTrace: " at
System.Diagnostics.EventLog.OpenForWrite()
at System.Diagnostics.EventLog.WriteEvent(Int32
eventID, Int16 category, EventLogEntryType type, String[]
strings, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID)
at FormRouter.Global.LogError(String sError) in
c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
TargetSite: {System.Reflection.RuntimeMethodInfo}

The inner exception is:
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
HelpLink: Nothing
InnerException: Nothing
Message: "Access is denied"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing


I don't quite understand. I am running .NET v.1.1.4322.
I am developing using VS .NET 2003. I am running Windows
2003 Server Enterprise.

Nov 18 '05 #3
hi guys,
you have to use "regedt32" (not regedit!!!) and give to the ASPNET user (or
the impersontated user if you use impersonation I suppose) the appropriate
rights to the EventLogs you want in the registry

don't have the info handy at the moment, try searching for "regedt32"
"asp.net" "log" using Copernic Agent Basic (it's free) from www.copernic.com

if you can't still find it, e-mail me privately and I can post more on this
thread searching my favorites entries

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <bi******@kagi.com>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.................................................. .......................
"Damian" <gr*****@yahoo.com> wrote in message
news:c2**************************@posting.google.c om...
Kevin, we're having the same problem here. The ASP.NET application,
currently installed on Windows 2003 Server, used to work fine on
Windows 2000.

We've set the Impersonate parameter to TRUE.

"Kevin Spencer" <ke***@takempis.com> wrote in message

news:<OU**************@TK2MSFTNGP10.phx.gbl>...
What account is your app running under? What are the permissions for this account?

--
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David Conorozzo" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I am able to create new sources using CreateEventSource.
I can call GetEventLogs, I can delete sources, I can see
if sources exist BUT, as soon as I try a "WriteEntry", I
get an exception:

{System.InvalidOperationException}
[System.InvalidOperationException]:
{System.InvalidOperationException}
HelpLink: Nothing
InnerException: {System.ComponentModel.Win32Exception}
Message: "Cannot open log for source {0}. You may not
have write access."
Source: "System"
StackTrace: " at
System.Diagnostics.EventLog.OpenForWrite()
at System.Diagnostics.EventLog.WriteEvent(Int32
eventID, Int16 category, EventLogEntryType type, String[]
strings, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID)
at FormRouter.Global.LogError(String sError) in
c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
TargetSite: {System.Reflection.RuntimeMethodInfo}

The inner exception is:
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
HelpLink: Nothing
InnerException: Nothing
Message: "Access is denied"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing


I don't quite understand. I am running .NET v.1.1.4322.
I am developing using VS .NET 2003. I am running Windows
2003 Server Enterprise.

Nov 18 '05 #4
I followed steps in
http://www.c-sharpcorner.com/Code/20...ngInASPNet.asp
I added my user (because we are impersonating) and ASPNet user with Full
Control over this registry setting.
Nothing different happened

Any idea?

Thanks

Lucas

"George Birbilis" <bi******@kagi.com> escribió en el mensaje
news:%2****************@TK2MSFTNGP10.phx.gbl...
hi guys,
you have to use "regedt32" (not regedit!!!) and give to the ASPNET user (or the impersontated user if you use impersonation I suppose) the appropriate
rights to the EventLogs you want in the registry

don't have the info handy at the moment, try searching for "regedt32"
"asp.net" "log" using Copernic Agent Basic (it's free) from www.copernic.com
if you can't still find it, e-mail me privately and I can post more on this thread searching my favorites entries

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <bi******@kagi.com>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.................................................. ......................
"Damian" <gr*****@yahoo.com> wrote in message
news:c2**************************@posting.google.c om...
Kevin, we're having the same problem here. The ASP.NET application,
currently installed on Windows 2003 Server, used to work fine on
Windows 2000.

We've set the Impersonate parameter to TRUE.

"Kevin Spencer" <ke***@takempis.com> wrote in message

news:<OU**************@TK2MSFTNGP10.phx.gbl>...
What account is your app running under? What are the permissions for this account?

--
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David Conorozzo" <an*******@discussions.microsoft.com> wrote in message news:06****************************@phx.gbl...
> I am able to create new sources using CreateEventSource.
> I can call GetEventLogs, I can delete sources, I can see
> if sources exist BUT, as soon as I try a "WriteEntry", I
> get an exception:
>
> {System.InvalidOperationException}
> [System.InvalidOperationException]:
> {System.InvalidOperationException}
> HelpLink: Nothing
> InnerException: {System.ComponentModel.Win32Exception}
> Message: "Cannot open log for source {0}. You may not
> have write access."
> Source: "System"
> StackTrace: " at
> System.Diagnostics.EventLog.OpenForWrite()
> at System.Diagnostics.EventLog.WriteEvent(Int32
> eventID, Int16 category, EventLogEntryType type, String[]
> strings, Byte[] rawData)
> at System.Diagnostics.EventLog.WriteEntry(String
> message, EventLogEntryType type, Int32 eventID, Int16
> category, Byte[] rawData)
> at System.Diagnostics.EventLog.WriteEntry(String
> message, EventLogEntryType type, Int32 eventID, Int16
> category)
> at System.Diagnostics.EventLog.WriteEntry(String
> message, EventLogEntryType type, Int32 eventID)
> at FormRouter.Global.LogError(String sError) in
> c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
> TargetSite: {System.Reflection.RuntimeMethodInfo}
>
> The inner exception is:
> {System.ComponentModel.Win32Exception}
> [System.ComponentModel.Win32Exception]:
> {System.ComponentModel.Win32Exception}
> HelpLink: Nothing
> InnerException: Nothing
> Message: "Access is denied"
> Source: Nothing
> StackTrace: Nothing
> TargetSite: Nothing
>
>
>
>
> I don't quite understand. I am running .NET v.1.1.4322.
> I am developing using VS .NET 2003. I am running Windows
> 2003 Server Enterprise.


Nov 18 '05 #5
It is running impersonation with Admin priviledges. The
problem I am having here is that I can actually create
Event SOURCES but then can't actually create entries.
Don't these 2 things involve similar permissions?
-----Original Message-----
What account is your app running under? What are the permissions for thisaccount?

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David Conorozzo" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
I am able to create new sources using CreateEventSource.
I can call GetEventLogs, I can delete sources, I can see
if sources exist BUT, as soon as I try a "WriteEntry", I
get an exception:

{System.InvalidOperationException}
[System.InvalidOperationException]:
{System.InvalidOperationException}
HelpLink: Nothing
InnerException: {System.ComponentModel.Win32Exception} Message: "Cannot open log for source {0}. You may not have write access."
Source: "System"
StackTrace: " at
System.Diagnostics.EventLog.OpenForWrite()
at System.Diagnostics.EventLog.WriteEvent(Int32
eventID, Int16 category, EventLogEntryType type, String [] strings, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID, Int16
category)
at System.Diagnostics.EventLog.WriteEntry(String
message, EventLogEntryType type, Int32 eventID)
at FormRouter.Global.LogError(String sError) in
c:\inetpub\wwwroot\FormRouter\Global.asax.vb:line 79"
TargetSite: {System.Reflection.RuntimeMethodInfo}

The inner exception is:
{System.ComponentModel.Win32Exception}
[System.ComponentModel.Win32Exception]:
{System.ComponentModel.Win32Exception}
HelpLink: Nothing
InnerException: Nothing
Message: "Access is denied"
Source: Nothing
StackTrace: Nothing
TargetSite: Nothing


I don't quite understand. I am running .NET v.1.1.4322.
I am developing using VS .NET 2003. I am running Windows 2003 Server Enterprise.

.

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1594
by: spp | last post by:
How can I save the contents of System events into a new file and the clear this event log. I want to do programaticaly something like using event viewer with Save Log File As... and then Clear all...
0
254
by: jeffrey_murdock | last post by:
hello mr./ms. C# guru, does somebody know how ho to catch "GUI events" from "other processes"? I'm only interessted in events which are related to the GUI. -GUI events like these 4 for...
6
1702
by: MattC | last post by:
I have some code that correctly writes to the eventlog on my local machine. I have installed the application on the Live server and all is not well, no event log entries. My development box...
0
376
by: Karthik Srinivasan | last post by:
Hi, My web application which runs on Windows 2003 server writes to EventLog during application startup but I get the following exception Requested registry access is not allowed. at...
0
1752
by: Tom Wingert | last post by:
Hi, I am having a problem with getting My.Log.WriteException to write to the Event Log in ASP.Net 2.0 with a web service. When an error occurs, My.Log.WriteException doesn't log anything to the...
6
2506
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
12
6032
by: Martyn Fewtrell | last post by:
Hi there I'm trying to find the correct way to write exceptions to the Application log using Vb.Net. I've done a fair bit of Googleing and although this gets plenty of mentions and that this...
9
10983
by: Jerry C | last post by:
I am trying to write to the errorlog and I am getting the error Cannot open log for source 'Application'. You may not have write access. This is the code: Dim Logevent As New...
3
2056
by: Peter Bradley | last post by:
Hi, I have a Web Service that has been running on a server for a couple of years. I now have to redeploy it to another server. Everything is fine except that the Web Service cannot write to...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.