Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
690 views
in Technique[技术] by (71.8m points)

asp.net - "Access to the registry key 'Global' is denied" when accessing performance counters

I'm attempting to read some performance counters from my ASP.NET application. When I do, I get the error "Access to the registry key 'Global' is denied."

I have tried following the instructions here and here, using the user IIS AppPoolDefaultAppPool, which is the identity my app pool is configured to use:

Screenshot of App Pool configuration

I have added that user to the Performance Monitor Users group:

enter image description here

And after adding the user, I restarted my computer. But I am still getting the error.

I have also tried adding the users IUSR and NETWORK SERVICE to the Performance Monitor Users group, but those don't work either. Out of desperation, I tried adding the user "Everyone" to the Performance Monitor Users group, and that actually does work. But my goal is to log statistics from my application in production, and I don't want to add "Everyone" to that group on the production server.

What else needs to happen in order to read the performance counters without generating a security exception?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the solution. Whereas various links around the Internet tell you to use the identity IIS APPPOOLDefaultAppPool, that is NOT the full story. That will only work if you are in fact assigning your applications to an app pool named "DefaultAppPool".

This link at ServerFault has the answer. You must use the name of your app pool. In my case, the app pool's name was "staging", so the correct user was IIS APPPOOLstaging. Putting this user in the Performance Monitor Users group fixed my issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...