PC Review


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

Access to the registry key 'Global' is denied

 
 
Dylan Parry
Guest
Posts: n/a
 
      17th Jul 2006
Hi folks,

I've just got a new machine at work, so I've spent all day copying
across all of my work from my old machine. Now I've come across a
problem that I've never seen before.

I now get the following error when I attempt to run one of my sites:

"Access to the registry key 'Global' is denied"

Here's the stack trace for the error:

--- start ---
[UnauthorizedAccessException: Access to the registry key 'Global' is
denied.]
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
+2116659
Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object
defaultValue, Boolean doNotExpand, Boolean checkSecurity) +2779573
Microsoft.Win32.RegistryKey.GetValue(String name) +29
System.Diagnostics.PerformanceMonitor.GetData(String item) +96
System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String
item) +147
System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +82
System.Diagnostics.PerformanceCounterLib.CounterExists(String
category, String counter, Boolean& categoryExists) +24
System.Diagnostics.PerformanceCounterLib.CounterExists(String
machine, String category, String counter) +90
System.Diagnostics.PerformanceCounter.Initialize() +720
System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, String instanceName, Boolean readOnly) +110
System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName) +16
Opus2.Page.Admin.Page_Load(Object sender, EventArgs e) +37314
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061
---- end ----

I know what code is causing the problem, but I also know that it runs
fine on both my old machine and the live server where the same site is
running.

Have I missed something out when I set up the new machine, or is there
something I can do to allow ASP.NET access to the registry key it's
complaining about?

Cheers,

--
Dylan Parry - http://webpageworkshop.co.uk

A Flower?
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      17th Jul 2006
Dylan,

What is the account that ASP.NET is configured to run under? AFAIK, the
ASPNET local user doesn't have rights to access the registry by default.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Dylan Parry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi folks,
>
> I've just got a new machine at work, so I've spent all day copying
> across all of my work from my old machine. Now I've come across a
> problem that I've never seen before.
>
> I now get the following error when I attempt to run one of my sites:
>
> "Access to the registry key 'Global' is denied"
>
> Here's the stack trace for the error:
>
> --- start ---
> [UnauthorizedAccessException: Access to the registry key 'Global' is
> denied.]
> Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
> +2116659
> Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object
> defaultValue, Boolean doNotExpand, Boolean checkSecurity) +2779573
> Microsoft.Win32.RegistryKey.GetValue(String name) +29
> System.Diagnostics.PerformanceMonitor.GetData(String item) +96
> System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String
> item) +147
> System.Diagnostics.PerformanceCounterLib.get_CategoryTable() +82
> System.Diagnostics.PerformanceCounterLib.CounterExists(String
> category, String counter, Boolean& categoryExists) +24
> System.Diagnostics.PerformanceCounterLib.CounterExists(String
> machine, String category, String counter) +90
> System.Diagnostics.PerformanceCounter.Initialize() +720
> System.Diagnostics.PerformanceCounter..ctor(String categoryName,
> String counterName, String instanceName, Boolean readOnly) +110
> System.Diagnostics.PerformanceCounter..ctor(String categoryName,
> String counterName) +16
> Opus2.Page.Admin.Page_Load(Object sender, EventArgs e) +37314
> System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
> o, Object t, EventArgs e) +15
> System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
> sender, EventArgs e) +34
> System.Web.UI.Control.OnLoad(EventArgs e) +99
> System.Web.UI.Control.LoadRecursive() +47
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> +1061
> ---- end ----
>
> I know what code is causing the problem, but I also know that it runs
> fine on both my old machine and the live server where the same site is
> running.
>
> Have I missed something out when I set up the new machine, or is there
> something I can do to allow ASP.NET access to the registry key it's
> complaining about?
>
> Cheers,
>
> --
> Dylan Parry - http://webpageworkshop.co.uk
>
> A Flower?



 
Reply With Quote
 
usenet@dylanparry.com
Guest
Posts: n/a
 
      18th Jul 2006
Nicholas Paldino [.NET/C# MVP] wrote:

(OT: For some obscure reason I am unable to post to this group through
News.Individual.Net when I'm in the office. I can get headers, but not
post. Other groups are fine, and it works at home... Hence I'm using GG
for this reply)

> What is the account that ASP.NET is configured to run under? AFAIK, the
> ASPNET local user doesn't have rights to access the registry by default.


Yes, it's running under ASPNET, but then it was running under that same

user (without any extra privileges) on the live server and on my old
machine. I don't pretend to know enough to start fiddling with user
permissions for things like ASP.NET :s

The actual code that is causing the problem, and the lines I have
commented out temporarily to get the system up and running, are:

PerformanceCounter pc = new PerformanceCounter("System", "System Up

Time");
pc.NextValue();
TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());

I'm presuming that it's the first line causing the problem as that one
is getting a value from the registry?

--
Dylan Parry - http://electricfreedom.org

A Flower?

 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      18th Jul 2006
This has reminded me of a very similar issue I once had, same symptons just
a different area of functionality. I had written a web based dotnet
application that would log any errors in the event log. On my PC
everything ran without fail every time, however on the production server it
would fail trying to write to the registry at what appeared to be random
intervals. I started off really confused because I wasn't knowingly writing
to the registry. Similar to you, all user accounts were identical, only
difference appeared to be the two machines I was running it on. Turns out
that the crashes were caused by the production code attempting to log an
error with the event log. The "source" of events are stored in the
registry, if you try to use a "source" that has not yet been setup, then it
attempts to write that new "source" to the registry - which will fail
because the APSNET user doesn't have those rights. The difference in my
case, turns out that I'd developed the logging component in a windows
console, therefore using my NT account details, which had rights to update
the registry with the new "Source". Then on my box, when ever the web based
application wanted to log an error, it could quite happily use the existing
"source".

To get around the issue there was some sort of customer action that I had to
set up as part of the install process (i.e. under a proper NT account,
rather than the ASPNET user). I'm guessing the performance counter
parameters may also be stored in the registry in a similar fashion.

- Paul.


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nicholas Paldino [.NET/C# MVP] wrote:
>
> (OT: For some obscure reason I am unable to post to this group through
> News.Individual.Net when I'm in the office. I can get headers, but not
> post. Other groups are fine, and it works at home... Hence I'm using GG
> for this reply)
>
>> What is the account that ASP.NET is configured to run under? AFAIK, the
>> ASPNET local user doesn't have rights to access the registry by default.

>
> Yes, it's running under ASPNET, but then it was running under that same
>
> user (without any extra privileges) on the live server and on my old
> machine. I don't pretend to know enough to start fiddling with user
> permissions for things like ASP.NET :s
>
> The actual code that is causing the problem, and the lines I have
> commented out temporarily to get the system up and running, are:
>
> PerformanceCounter pc = new PerformanceCounter("System", "System Up
>
> Time");
> pc.NextValue();
> TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());
>
> I'm presuming that it's the first line causing the problem as that one
> is getting a value from the registry?
>
> --
> Dylan Parry - http://electricfreedom.org
>
> A Flower?
>



 
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
Registry Access Denied Calvin Windows XP General 2 25th Jun 2009 04:17 AM
When standard users access Vista registry remotely, Access Denied =?Utf-8?B?R2F5bGU=?= Windows Vista Administration 1 10th Oct 2007 05:48 PM
Registry access denied =?Utf-8?B?QmFuZXNraQ==?= Windows XP Help 1 14th Nov 2006 08:12 AM
Registry access denied =?Utf-8?B?YmRzbWNzZQ==?= Windows XP General 3 9th Mar 2005 09:17 PM
Access to the registry key is denied KH Microsoft ADO .NET 2 29th Sep 2003 08:45 PM


Features
 

Advertising
 

Newsgroups
 


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