PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

ASPNET can't write in event log on win XP

 
 
=?Utf-8?B?U3RlcGhhbmU=?=
Guest
Posts: n/a
 
      18th Jan 2005
Hi,

I'm trying to write in the event log and it looks like it's any of my
applications which are called by ASP.NET that are having trouble with event
log. Here's the
error:

System.InvalidOperationException: Cannot open log for source {0}. You may
not have write access. ---> System.ComponentModel.Win32Exception: Access is
denied

I didn't have this problem on windows 2000. But since I'm on Win XP now, I
have to solve this. I set full control to everyone on every drive of my
computer and it still not working...

Any idea of how to set permissions so ASPNET can write in event log in Win Xp?

Thanks,

Steph


 
Reply With Quote
 
 
 
 
richlm
Guest
Posts: n/a
 
      18th Jan 2005
see http://support.microsoft.com/default...b;en-us;842795

Yes the default registry permissions on XP/2003 are tighter than on 2000.

The first time your app tries to write to the event log, it checks to see if
an event source for your application (typically the application name)
already exists. If not, it tries to create it.

Event log sources are stored in the registry under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\...

Changing file system permissions will have no effect on the registry. If you
start regedit.exe and locate the registry key above, right click and select
'Permissions' you can see which accounts do have access.
You could just add the ASPNET account here, but this is a BAD idea because
it will complicate deployment of your application and weaken security.

The usual solution is to create the event source at installation time using
EventLog.CreateEventSource (or the EventLogInstaller class). Installation
will normally be done in the context of an administrator account.

Here's a couple of links to get you started:
http://msdn.microsoft.com/library/de...Installers.asp
http://msdn.microsoft.com/library/de...logentries.asp


 
Reply With Quote
 
=?Utf-8?B?U3RlcGhhbmU=?=
Guest
Posts: n/a
 
      18th Jan 2005
Hi,

Thanks for your answer. The event source already exists. It has been created
by my application at the time it's not called by ASPNET (I also have a server
running as a service which logs the same event source).

So, since the entry is already created, why can't I write new logs with
ASPNET?

Any other idea?

Thanks,

Steph

"richlm" wrote:

> see http://support.microsoft.com/default...b;en-us;842795
>
> Yes the default registry permissions on XP/2003 are tighter than on 2000.
>
> The first time your app tries to write to the event log, it checks to see if
> an event source for your application (typically the application name)
> already exists. If not, it tries to create it.
>
> Event log sources are stored in the registry under:
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\...
>
> Changing file system permissions will have no effect on the registry. If you
> start regedit.exe and locate the registry key above, right click and select
> 'Permissions' you can see which accounts do have access.
> You could just add the ASPNET account here, but this is a BAD idea because
> it will complicate deployment of your application and weaken security.
>
> The usual solution is to create the event source at installation time using
> EventLog.CreateEventSource (or the EventLogInstaller class). Installation
> will normally be done in the context of an administrator account.
>
> Here's a couple of links to get you started:
> http://msdn.microsoft.com/library/de...Installers.asp
> http://msdn.microsoft.com/library/de...logentries.asp
>
>
>

 
Reply With Quote
 
=?Utf-8?B?U3RlcGhhbmU=?=
Guest
Posts: n/a
 
      18th Jan 2005
I tried adding ASPNET to the registry permissions and it didn't work. I also
put ASPNET in adminstrator group and it still not working... I get the same
error.

I thought this would work but it's not:
http://searchvb.techtarget.com/vsnet...293033,00.html

I running short of ideas!!

any other idea?

Thanks,

Steph

"Stephane" wrote:

> Hi,
>
> Thanks for your answer. The event source already exists. It has been created
> by my application at the time it's not called by ASPNET (I also have a server
> running as a service which logs the same event source).
>
> So, since the entry is already created, why can't I write new logs with
> ASPNET?
>
> Any other idea?
>
> Thanks,
>
> Steph
>
> "richlm" wrote:
>
> > see http://support.microsoft.com/default...b;en-us;842795
> >
> > Yes the default registry permissions on XP/2003 are tighter than on 2000.
> >
> > The first time your app tries to write to the event log, it checks to see if
> > an event source for your application (typically the application name)
> > already exists. If not, it tries to create it.
> >
> > Event log sources are stored in the registry under:
> > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\...
> >
> > Changing file system permissions will have no effect on the registry. If you
> > start regedit.exe and locate the registry key above, right click and select
> > 'Permissions' you can see which accounts do have access.
> > You could just add the ASPNET account here, but this is a BAD idea because
> > it will complicate deployment of your application and weaken security.
> >
> > The usual solution is to create the event source at installation time using
> > EventLog.CreateEventSource (or the EventLogInstaller class). Installation
> > will normally be done in the context of an administrator account.
> >
> > Here's a couple of links to get you started:
> > http://msdn.microsoft.com/library/de...Installers.asp
> > http://msdn.microsoft.com/library/de...logentries.asp
> >
> >
> >

 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      18th Jan 2005
On Tue, 18 Jan 2005 06:31:08 -0800, "Stephane" <(E-Mail Removed)> wrote:

¤ Hi,
¤
¤ Thanks for your answer. The event source already exists. It has been created
¤ by my application at the time it's not called by ASPNET (I also have a server
¤ running as a service which logs the same event source).
¤
¤ So, since the entry is already created, why can't I write new logs with
¤ ASPNET?
¤

Because the user account your web application is running under (probably ASPNET) does not have
sufficient permissions. I think that is what richlm was implying. See the following:

http://msdn.microsoft.com/library/de...feventlogs.asp


Paul ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
=?Utf-8?B?U3RlcGhhbmU=?=
Guest
Posts: n/a
 
      18th Jan 2005
As I previously said, I added ASPNET to the administrators group and it still
saying access denied... Administartors are supposed to have all needed
rights, aren't they?

Thanks,

Steph

"Paul Clement" wrote:

> On Tue, 18 Jan 2005 06:31:08 -0800, "Stephane" <(E-Mail Removed)> wrote:
>
> ¤ Hi,
> ¤
> ¤ Thanks for your answer. The event source already exists. It has been created
> ¤ by my application at the time it's not called by ASPNET (I also have a server
> ¤ running as a service which logs the same event source).
> ¤
> ¤ So, since the entry is already created, why can't I write new logs with
> ¤ ASPNET?
> ¤
>
> Because the user account your web application is running under (probably ASPNET) does not have
> sufficient permissions. I think that is what richlm was implying. See the following:
>
> http://msdn.microsoft.com/library/de...feventlogs.asp
>
>
> Paul ~~~ (E-Mail Removed)
> Microsoft MVP (Visual Basic)
>

 
Reply With Quote
 
Morgan
Guest
Posts: n/a
 
      18th Jan 2005
Just a guess, but did you stop and restart IIS?
"Stephane" <(E-Mail Removed)> wrote in message
news:3447D043-E20A-47D4-9B77-(E-Mail Removed)...
> As I previously said, I added ASPNET to the administrators group and it
> still
> saying access denied... Administartors are supposed to have all needed
> rights, aren't they?
>
> Thanks,
>
> Steph
>
> "Paul Clement" wrote:
>
>> On Tue, 18 Jan 2005 06:31:08 -0800, "Stephane"
>> <(E-Mail Removed)> wrote:
>>
>> ¤ Hi,
>> ¤
>> ¤ Thanks for your answer. The event source already exists. It has been
>> created
>> ¤ by my application at the time it's not called by ASPNET (I also have a
>> server
>> ¤ running as a service which logs the same event source).
>> ¤
>> ¤ So, since the entry is already created, why can't I write new logs with
>> ¤ ASPNET?
>> ¤
>>
>> Because the user account your web application is running under (probably
>> ASPNET) does not have
>> sufficient permissions. I think that is what richlm was implying. See the
>> following:
>>
>> http://msdn.microsoft.com/library/de...feventlogs.asp
>>
>>
>> Paul ~~~ (E-Mail Removed)
>> Microsoft MVP (Visual Basic)
>>



 
Reply With Quote
 
=?Utf-8?B?U3RlcGhhbmU=?=
Guest
Posts: n/a
 
      18th Jan 2005
Of course I did! ;-)

I solve my problem using impersonation in web.config like this...

<identity impersonate="true" userName="stephane" password="12345"/>

I guess this is not te best way, but at least it's working on my development
server.

Thanks,

Steph

"Morgan" wrote:

> Just a guess, but did you stop and restart IIS?
> "Stephane" <(E-Mail Removed)> wrote in message
> news:3447D043-E20A-47D4-9B77-(E-Mail Removed)...
> > As I previously said, I added ASPNET to the administrators group and it
> > still
> > saying access denied... Administartors are supposed to have all needed
> > rights, aren't they?
> >
> > Thanks,
> >
> > Steph
> >
> > "Paul Clement" wrote:
> >
> >> On Tue, 18 Jan 2005 06:31:08 -0800, "Stephane"
> >> <(E-Mail Removed)> wrote:
> >>
> >> ¤ Hi,
> >> ¤
> >> ¤ Thanks for your answer. The event source already exists. It has been
> >> created
> >> ¤ by my application at the time it's not called by ASPNET (I also have a
> >> server
> >> ¤ running as a service which logs the same event source).
> >> ¤
> >> ¤ So, since the entry is already created, why can't I write new logs with
> >> ¤ ASPNET?
> >> ¤
> >>
> >> Because the user account your web application is running under (probably
> >> ASPNET) does not have
> >> sufficient permissions. I think that is what richlm was implying. See the
> >> following:
> >>
> >> http://msdn.microsoft.com/library/de...feventlogs.asp
> >>
> >>
> >> Paul ~~~ (E-Mail Removed)
> >> Microsoft MVP (Visual Basic)
> >>

>
>
>

 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      19th Jan 2005
On Tue, 18 Jan 2005 12:31:09 -0800, "Stephane" <(E-Mail Removed)> wrote:

¤ Of course I did! ;-)
¤
¤ I solve my problem using impersonation in web.config like this...
¤
¤ <identity impersonate="true" userName="stephane" password="12345"/>
¤
¤ I guess this is not te best way, but at least it's working on my development
¤ server.
¤
¤ Thanks,
¤
¤ Steph

That's interesting. You weren't using Anonymous authentication w/impersonation when it wasn't
working were you?


Paul ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPNET write problem PROVENTIA CAUSED =?Utf-8?B?U2FuZHBvaW50R3V5?= Microsoft ASP .NET 0 7th Nov 2007 03:30 PM
ASPNET does not have write access ... tried everything? =?Utf-8?B?U2FuZHBvaW50R3V5?= Microsoft ASP .NET 9 7th Nov 2007 01:51 AM
Re: ASPNET can't write in event log on win XP Kevin Spencer Microsoft ASP .NET 3 18th Jan 2005 08:29 PM
How do I set ASPNET account write access on Windows2003 Server? Paul D. Fox Microsoft Dot NET 2 9th Mar 2004 03:47 PM
Write permissions for ASPNET user on Windows 2003 Jose Lopes Moreira Microsoft ASP .NET 0 18th Jul 2003 04:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.