Problem in Adding Performance Counter used in Windows Service viva Octopus

When we are trying to deploy a windows service using Octopus service is unable to add the performance counters. But when the same service is been installed with the help of msi file or the setup project we are able to see the performance counter added to the server.

Error Message : The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

Code line : xxxxxxxxx = new PerformanceCounter(xxxxxx,xxxxxx,xxxxxxxx,false);

Hi @Agnchoudhary1990,

Thanks for getting in touch! Seeing as it works when you locally install the service with the MSI, the first thought that comes to mind is that the service account used for the service does not have the required permissions for the performance counter to work. But we will need to see how this is being deployed and the error you are receiving.

Would you be able to attach a full deployment log? It should help to tell us what is happening when this service is being deployed.

Here is a link on how to retrieve these logs:

Looking forward to hearing form you and getting to the bottom of this. :slight_smile:


Hi Daniel,

Thanks for a quick reply.
We were able to fix the issue. Since when we where installing using MSI file in the installer method we were calling a method which we used to create a performance counter. when we called the same method in the start() of our service it created the performance counter.

Avinash Choudhary.