views:

161

answers:

2

Hi folks,

I'm trying to add some performance counters to my asp.net website. Now, I know how to increment/decrement some custom counter I make .. but my problem is that if I get my ASP.NET website to create these counters, if they do not exist (eg. i do this check in the global.asax App start method) then add/create them.

But, it doesn't work - access to the registry is denied/forbidden.

I'm assuming this is because the asp.net process is so stripped down (for security) that u can't touch that type of thing.

Therefore, i'm wondering if the only other solution is to make a quick console or winform app which does one thing -> add's the perf counters. running this as my normal logged in user would me i have admin rights, so it will work.

or is there something else i can do?

+2  A: 

That's correct.

Microsoft recommend installing the counters before hand, during installation of the app.

Use the PerformanceCounterInstaller class to set your counters up when logged in with a user that has sufficient permissions to create them.

If you create an installer for you application, you can setup the counters in the installer project.

Oded
thanks guys (massive bummer). i was afraid of that :)
Pure.Krome
+1  A: 

Well, in addition to a console/winform solution you could create a setup application that is run on all web servers.

JD