English 中文(简体)
Adding performance counters via my ASP.NET code?
原标题:

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?

最佳回答

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.

问题回答

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





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签