Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:01:47+00:00 2026-06-11T22:01:47+00:00

I’m having issues getting my permissions in order to allow my application (running in

  • 0

I’m having issues getting my permissions in order to allow my application (running in an IIS7 AppPool) to delete/add Performance Counter Categories and their data. I have code like so:

if (!PerformanceCounterCategory.Exists(CategoryName))
{
    var counters = new CounterCreationDataCollection();
    var opsIn = new CounterCreationData
    {
        CounterName = "Test Counter",
        CounterHelp = "Test Counter Help",
        CounterType = PerformanceCounterType.RateOfCountsPerSecond32
    };
    counters.Add(opsIn);

    PerformanceCounterCategory.Create(CategoryName, "Service Layer Instrumentation",
                                      PerformanceCounterCategoryType.SingleInstance,
                                      counters);
}

The intent is to create performance counters on a system that doesn’t yet have them created, so I’m not bound to a static installer behavior (I want to be able to alter counters without a lot of fuss). So far, when this works, it works well.

When I run this code in an executable, as admin, there are no problems. However, when I run it inside an IIS service, the AppPool does not have the correct permissions to execute the category alterations. I know for a fact that it’s possible to get the WMI permissions to work correctly, because I did it once before for a demo with a test server… but that was months ago, I was tired, and it was last minute. The whole thing’s a blur. I’m unable to reproduce my results now that I’m going back trying to formalize the install process to include the necessary security changes.

Google is only marginally helpful, and I distinctly recall having to hodgepodge together instructions from several pages before the thing worked. Does anyone have a recommendation for the complete instructions to enable Performance Counter Category editing for an IIS app pool?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:01:49+00:00Added an answer on June 11, 2026 at 10:01 pm

    If you do not want to run your performance counter code in a separate process then you can do the following below by elevating permissions.

    http://msdn.microsoft.com/en-us/library/bd20x32d(v=vs.71).aspx

    The above link explains performance counters in ASP.NET applications, and how ASP.NET by default does not have permission to create custom performance counters and can not read performance counters. Below is a quote from the article.

    If you are using a PerformanceCounter component in an ASP.NET application, the default settings of the ASPNET user account restrict access to performance counters. The ASPNET user account, by default, can write to but not read from performance counters, and it cannot create new categories. You can use impersonation with the ASPNET account to allow creation of new categories. The impersonation identity must have sufficient privileges to create categories. If your application needs performance counters that can be specified before deployment, they can be created by the deployment project. For more information, see ASP.NET Web Application Security.

    You can impersonate asp to run as a separate account that you could grant privileges too. Sample code from the ASP.NET impersonation article is below, of course you can encrypt this user name and password also. The article explains how to encrypt the username and password.

    http://msdn.microsoft.com/en-us/library/aa719560(v=vs.71).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.