简体   繁体   English

WebRequest.Create抛出IOException“指定的注册表项不存在。”

[英]WebRequest.Create throws IOException “The specified registry key does not exist.”

I am calling this line of code to get to the azure server: 我正在调用这行代码来访问azure服务器:

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

and receive this exception. 并收到此例外。 Does anybody know how to manage with it? 有人知道怎么用它来管理吗?

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   

This solution helped HttpClient request throws IOException , although we have different call stacks. 虽然我们有不同的调用堆栈,但此解决方案帮助HttpClient请求抛出IOException

You need to create these keys in registry. 您需要在注册表中创建这些密钥。

Path: HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\.NETFramework 路径:HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ .NETFramework

Key: 键:

name: "LegacyWPADSupport" type: "dword" data:00000000 name:“LegacyWPADSupport”类型:“dword”数据:00000000

Path: HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\.NETFramework 路径:HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Wow6432Node \\ Microsoft \\ .NETFramework

Key: 键:

name: "LegacyWPADSupport" type: "dword" data:00000000 name:“LegacyWPADSupport”类型:“dword”数据:00000000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM