Showing posts with label registry. Show all posts
Showing posts with label registry. Show all posts

Tuesday, March 13, 2012

System.Security.SecurityException: Requested registry access is not allowed.

This seems like a simple enough notion: Log web application events to the system EventLog so they can be reviewed for problems at any time.
To this notion, Windows says: System.Security.SecurityException: Requested registry access is not allowed.

You have GOT to be kidding me...

Here's a snipped stack trace:

[SecurityException: Requested registry access is not allowed.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +2780649
System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(String source, String logName) +41


It should be pretty obvious what I'm trying to do. What security settings must I change to allow my ASP.NET application to create this EventLog source and subsequently write log events?

Thanks for any help,

You have to give the ASP.NET porcess account access to modify the event log entries. There are a number of KB articles about this and related issues. Might start here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;842795

Jeff


Cool, thanks! :)

ASTECH:

You have GOT to be kidding me...

Wow, so you'd be cool that the Windows Registry gave access to running code by default?

Can you image the havok created if someone had a third party dll in their web project or some other made-with-.NET programming running that was reading and reporting EventLog details back to some remote server somewhere?

Explicitly setting the permission is absolutely the best route there.... protects programmeres/end-users fromthemselves


Do you expect a reply to that? If you're really begging for a reply to that, here: "I couldn't care less."

The EventLog is the central logging facility for Windows. Duh? Let my .NET applications write entries without bothering me with these overly paranoid, annoying details. This has just been one more delay in what should have been an easy development cycle...

By the way: "If you don't have anything nice to say or constructive to add, KEEP IT SHUT!"

There's a definite security concern with allowing the .NET process to write to the Windows event logs. The proper method would be to create your own event log for your app and write to that. In all cases never allow access to the secuirty log, makes it too easy to cover your tracks when you're hacking.

As long as you're comfortable with allowing the access, it's fine with us. If you wish to avoid further delays in your development cycle due to security issues, I suggest you make the group Everyone a local administrator and change all your processes to use the Administrator account. That way you pretty much won't be pestered by security issues in your coding.

Jeff


jeff@.zina.com:

If you wish to avoid further delays in your development cycle due to security issues, I suggest you make the group Everyone a local administrator and change all your processes to use the Administrator account. That way you pretty much won't be pestered by security issues in your coding.

Jeff

Now that's funny! What a blissful world we'd all live in if everyone everywhere did exactly that! (tongue in cheek)

System.Security.SecurityException: Requested registry access is not allowed.

I keep getting this error when my asp.net application tries to write into
the registry
System.Security.SecurityException: Requested registry access is not allowed.
I followed the following article and I still get the error:
http://support.microsoft.com/defaul...kb;en-us;329291
Any suggestions?
ThanksWhen you say write to the registry, do you mean using the EventLog? Or do
you mean explicitly writing to the registry? The account that your ASP.NET
code is running as needs the rights to do whatever you're trying to do. Unde
r
IIS5 it's the local ASPNET account. Under IIS6 it's the local Network Servic
e
account.
-Brock
DevelopMentor
http://staff.develop.com/ballen

> I keep getting this error when my asp.net application tries to write
> into
> the registry
> System.Security.SecurityException: Requested registry access is not
> allowed.
> I followed the following article and I still get the error:
> http://support.microsoft.com/defaul...kb;en-us;329291
> Any suggestions?
> Thanks
>
Actually the problem was that I did not creat the Installet class properly
so Gacutil was unable to create the right permissions for my ASPNET user.
Thanks for your help
"Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
news:763197632520356933089056@.msnews.microsoft.com...
> When you say write to the registry, do you mean using the EventLog? Or do
> you mean explicitly writing to the registry? The account that your ASP.NET
> code is running as needs the rights to do whatever you're trying to do.
> Under IIS5 it's the local ASPNET account. Under IIS6 it's the local
> Network Service account.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>

System.Security.SecurityException: Requested registry access is not allowed.

I keep getting this error when my asp.net application tries to write into
the registry
System.Security.SecurityException: Requested registry access is not allowed.

I followed the following article and I still get the error:
http://support.microsoft.com/defaul...kb;en-us;329291

Any suggestions?

ThanksWhen you say write to the registry, do you mean using the EventLog? Or do
you mean explicitly writing to the registry? The account that your ASP.NET
code is running as needs the rights to do whatever you're trying to do. Under
IIS5 it's the local ASPNET account. Under IIS6 it's the local Network Service
account.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> I keep getting this error when my asp.net application tries to write
> into
> the registry
> System.Security.SecurityException: Requested registry access is not
> allowed.
> I followed the following article and I still get the error:
> http://support.microsoft.com/defaul...kb;en-us;329291
> Any suggestions?
> Thanks
Actually the problem was that I did not creat the Installet class properly
so Gacutil was unable to create the right permissions for my ASPNET user.

Thanks for your help
"Brock Allen" <ballen@.NOSPAMdevelop.com> wrote in message
news:763197632520356933089056@.msnews.microsoft.com ...
> When you say write to the registry, do you mean using the EventLog? Or do
> you mean explicitly writing to the registry? The account that your ASP.NET
> code is running as needs the rights to do whatever you're trying to do.
> Under IIS5 it's the local ASPNET account. Under IIS6 it's the local
> Network Service account.
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>> I keep getting this error when my asp.net application tries to write
>> into
>> the registry
>> System.Security.SecurityException: Requested registry access is not
>> allowed.
>> I followed the following article and I still get the error:
>> http://support.microsoft.com/defaul...kb;en-us;329291
>>
>> Any suggestions?
>>
>> Thanks
>>