Search code examples
c#wcfexceptionregistry

WCF: The specified registry key does not exist in base.Channel call


I am getting an error: "The specified registry key does not exist" when the following WCF code is being executed:

return base.Channel.GetRateSheet(request);

This is the rest of the method in which this is used:

public GetRateSheetResponse GetRateSheet(GetRateSheetRequest request)
{
    return base.Channel.GetRateSheet(request);
} 

The config for this endpoint is:

<endpoint address="http://*********/*******/Service.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBusinessService"
          name="Endpoint_RateSheetService"
          contract="*********.RateSheetService" />

This code used to work for many weeks, and this morning is started throwing this error.

There is no inner exception and the only stack trace I get is:

at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)

I did all the common tire-kicking: restarted VS, rebooted machine, got latest version of the source code.

Running XP 32 bit.

[EDIT:] When I go to the bin folder of the solution and run the executable direcly, it works - no error. The error only occurs when running from Visual Studio


Solution

  • Seems people have faced similar issues after installing a security patch for the .NET Framework: MS12-074: Vulnerabilities in .NET Framework could allow remote code execution: November 13, 2012

    You can ask microsoft to fix it here

    Workaround - Add the following registry key:

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

    For 64 bit machines

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