ASP.NET Performance: Performance Counters on Windows Client + IIS Express

Editor note: This blog is originally published by Christy Henriksson on 09-12-2012 in Web Performance Blog, which will be obsolete soon.  Future ASP.NET related performance blogs will be posted here.

I learned recently that ASP.NET performance counters are not available on Windows 7 or 8 (client) when running with IIS Express (or the Dev10 default of Cassini).  Fortunately, the fix is easy: run Visual Studio as Administrator.

If you’re using IIS Express without Visual Studio installed (for example, WebMatrix), then you’ll first need to install ASP.NET 4.5 features:

dism /online /enable-feature /featureName:NetFx4Extended-ASPNET45 /all

UPDATE: The above dism command is specific to Win8.  Basically, you need to make sure ASP.NET features are enabled on the machine in order for performance counters to get registered.  This happens automatically when you install VS.  For Win7 client, you can enable ASP.NET 3.5 features with a command like the following (note that /all isn’t available for automatically enabling parent features):

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:WAS-WindowsActivationService /featurename:WAS-ProcessModel /featurename:WAS-NetFxEnvironment /featurename:WAS-ConfigurationAPI /featurename:IIS-ApplicationDevelopment /featurename:IIS-ASPNET /featurename:IIS-DefaultDocument /featurename:IIS-NetFxExtensibility /featurename:IIS-ISAPIExtensions /featurename:IIS-ISAPIFilter /featurename:IIS-RequestFiltering /featurename:IIS-Metabase /featurename:IIS-WMICompatibility /featurename:IIS-LegacyScripts /featurename:IIS-IIS6ManagementCompatibility /featurename:IIS-WebServerManagementTools /featurename:IIS-HttpTracing