2013-03-25 14 views
6

Wołam tego wiersza kodu, aby dostać się do serwera lazurowym:WebRequest.Create zgłasza wyjątek IOException "Podany klucz rejestru nie istnieje."

var request = (HttpWebRequest)WebRequest.Create(uri); 

i odbierać ten wyjątek. Czy ktoś wie, jak sobie z nim radzić?

mscorlib.dll!Microsoft.Win32.RegistryKey.Win32Error(int errorCode, string str) + 0x189 bytes  
mscorlib.dll!Microsoft.Win32.RegistryKey.GetValueKind(string name) + 0x7f bytes 
System.dll!System.Net.HybridWebProxyFinder.InitializeFallbackSettings() + 0xb8 bytes  
System.dll!System.Net.HybridWebProxyFinder.HybridWebProxyFinder() + 0x1e bytes 
[Native to Managed Transition] 
[Managed to Native Transition] 
System.dll!System.Net.HybridWebProxyFinder.HybridWebProxyFinder(System.Net.AutoWebProxyScriptEngine engine) + 0x37 bytes  
System.dll!System.Net.AutoWebProxyScriptEngine.AutoWebProxyScriptEngine(System.Net.WebProxy proxy, bool useRegistry) + 0x190 bytes 
System.dll!System.Net.WebProxy.UnsafeUpdateFromRegistry() + 0x67 bytes 
System.dll!System.Net.WebProxy.WebProxy(bool enableAutoproxy) + 0x44 bytes 
System.dll!System.Net.Configuration.DefaultProxySectionInternal.DefaultProxySectionInternal(System.Net.Configuration.DefaultProxySection section) + 0x3d9 bytes 
System.dll!System.Net.Configuration.DefaultProxySectionInternal.GetSection() + 0xbe bytes 
System.dll!System.Net.WebRequest.InternalDefaultWebProxy.get() + 0x7e bytes 
System.dll!System.Net.HttpWebRequest.HttpWebRequest(System.Uri uri, System.Net.ServicePoint servicePoint) + 0x18d bytes 
System.dll!System.Net.HttpRequestCreator.Create(System.Uri Uri) + 0x50 bytes  
System.dll!System.Net.WebRequest.Create(System.Uri requestUri, bool useUriBase) + 0x2ec bytes 
System.dll!System.Net.WebRequest.Create(string requestUriString) + 0xa3 bytes 
+0

OK, wygląda na to, że rozwiązanie pomogło LegacyWPADSupport, chociaż mamy inny stos wywołań. –

+0

Czy kiedykolwiek rozwiązałeś to? – skimania

+2

Tak. To rozwiązanie pomogło http://stackoverflow.com/questions/13141434/httpclient-request-throws-ioexception/13745641#13745641, chociaż mamy różne stosy wywołań. –

Odpowiedz

3

To rozwiązanie pomogło HttpClient request throws IOException, chociaż mamy różne stosy połączeń.

Musisz utworzyć te klucze w rejestrze.

Ścieżka: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ .NETFramework

Klucz:

nazwa: "LegacyWPADSupport" typu: "DWORD" Dane: 00000000

Ścieżka: HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ .NETFramework

Klucz:

nazwa: "LegacyWPADSupport" typu: "DWORD" dane: 00000000

+2

Dla kompletności klucze są w: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ .NETFramework i HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ .NETFramework – Rob

+0

Dzięki. Formatowanie zjadło ukośnik przed kropką (\.). Zmieniłem odpowiedź, aby uzyskać prawidłowy obraz. –

Powiązane problemy