This is the code:
    private static void CreateCounter()
    {
        if (PerformanceCounterCategory.Exists("DemoCategory"))
            PerformanceCounterCategory.Delete("DemoCategory");
        CounterCreationDataCollection ccdArray = new CounterCreationDataCollection();
        CounterCreationData ccd = new CounterCreationData();
        ccd.CounterName = "RequestsPerSecond";
        ccd.CounterType = PerformanceCounterType.NumberOfItems32;
        ccd.CounterHelp = "Requests per second";
        ccdArray.Add(ccd);
        PerformanceCounterCategory.Create("DemoCategory", "Demo category",
            PerformanceCounterCategoryType.SingleInstance, ccdArray);
        Console.WriteLine("Press any key, to start use the counter");
    }
Obviously:
PerformanceCounterCategory.Create("DemoCategory", "Demo category", 
     PerformanceCounterCategoryType.SingleInstance, ccdArray);
is the line where the exception was thrown.
I have read about PerformanceCounterPermission, what should I do exactly?