When you are using .NET 2.0 or .NET 3.5 and you are trying to make a web request with WebRequest class you may see the following internal error if you have Common Language Runtime Exceptions enabled during debugging in Visual Studio:
Exception thrown: ‘System.InvalidOperationException’ in System.dll
Additional information: The key ‘LocalizedPerfCounter’ does not exist in the appSettings configuration section.
To fix it, add a new Application Configuration File(App.config) to your application with the following contents:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="LocalizedPerfCounter" value="true" /> </appSettings> </configuration>