You can change the name of the service, contract, or operation to be either short enough or different enough. The instance name for an operation counter is (ServiceName).(ContractName).(OperationName)@(first endpoint listener address). To avoid conflict, make sure that the name is shorter than 64 characters, or no operations in the service start with the same 13 characters.
For example, assume that you have a service called "Service," with a contract called "IService" and operations called "MyOperationName1" and "MyOperationName2" that are hosted at http://mybusinessaddress.com/endpoint. The counter instance names before shortening would be Service.IService.MyOperationName1@http://mybusinessaddress.com/endpoint and Service.IService.MyOperationName2@http://mybusinessaddress.com/endpoint. Both are shortened to Service.IServi91.MyOperationNa78@39mybusinessaddress.com/endpoint, and that causes a conflict. You could avoid this conflict by changing the operation names so that they do not start with the same 13 characters (for example, OperationName1 and MyOperationName2). You could also avoid it by shortening another piece of the name, such as hosting the service at http://mybusinessaddress.com/e, to keep the instance name at 64 characters. In this manner, the counter instance name will not be shortened.
When your application is running the .NET Framework 4.6 or later versions, you can enable a setting in WCF to make sure that the instance names are unique by appending a longer hash to the end of one instance name. You must do both of the following:
- Add the following line to the appSettings in your configuration file:
<add key="wcf:ensureUniquePerformanceCounterInstanceNames" value="true" />
- Make sure that the user who hosts the service is either an administrator or a member of the Performance Monitor Users Windows user group.
When the appSetting is enabled and the user who hosts the service is not an administrator or in the user group that is described previously, WCF will ignore this setting, and emit the following warning in the svclog file:
Article ID: 3058669 - Last Review: 05 May 2015 - Revision: 1