HttpClient System.IO.IOException “The specified registry key does not exist.”

Written on May 01, 2013

With .NET Framework 4.5 (or .NET 4.0 NuGet: Microsoft.AspNet.WebApi.Client), a new HttpClient for .NET has been embraced.

The usage is as simple as it could be:

When debugging this piece of code, you might get this excecption:

System.IO.IOException “The specified registry key does not exist.”

This is caused by the security update

MS12-074: Vulnerabilities in .NET Framework could allow remote code execution: November 13, 2012

To get rid of the Exception from above, you have to add the registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]

"LegacyWPADSupport"=dword:00000000

On x64 systems, the key is:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
"LegacyWPADSupport"=dword:00000000

For convenience, I've added a .reg-File which you can use (at your own risk, of course as it does change your system settings).