相关疑难解决方法(0)

HttpClient请求抛出IOException

以下代码抛出IOException并显示以下消息:"指定的注册表项不存在."

HttpClient client = new HttpClient();

Uri uri = new Uri("http://www.google.com");

client.GetAsync(uri);
Run Code Online (Sandbox Code Playgroud)

这只是在Main的控制台应用程序中.看起来mscorlib.dll抛出了错误!Microsoft.Win32.RegistryKey.Win32Error(int errorCode,string str).我不知道为什么抛出这个错误或者如何开始调试它.

编辑堆栈跟踪:

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

它只有1行,没有内在的例外等.

调用堆栈是:

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() + 0x9e bytes    
[Native to Managed Transition]  
[Managed to Native Transition]  
System.dll!System.Net.AutoWebProxyScriptEngine.AutoWebProxyScriptEngine(System.Net.WebProxy proxy, bool useRegistry) + 0xd0 bytes   
System.dll!System.Net.WebProxy.UnsafeUpdateFromRegistry() + 0x2c bytes  
System.dll!System.Net.Configuration.DefaultProxySectionInternal.DefaultProxySectionInternal(System.Net.Configuration.DefaultProxySection section) + 0x1d8 bytes 
System.dll!System.Net.Configuration.DefaultProxySectionInternal.GetSection() + 0xec bytes   
System.dll!System.Net.WebRequest.InternalDefaultWebProxy.get() + 0xcc bytes 
System.dll!System.Net.HttpWebRequest.HttpWebRequest(System.Uri uri, System.Net.ServicePoint servicePoint) + 0xdf bytes  
System.dll!System.Net.HttpWebRequest.HttpWebRequest(System.Uri uri, bool returnResponseOnFailureStatusCode, …
Run Code Online (Sandbox Code Playgroud)

.net c# httpclient ioexception

70
推荐指数
3
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

httpclient ×1

ioexception ×1