gpt4 book ai didi

c# - WebRequest.Create 抛出 IOException "The specified registry key does not exist."

转载 作者:太空狗 更新时间:2023-10-29 21:50:47 27 4
gpt4 key购买 nike

我正在调用这行代码来访问 Azure 服务器:

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

并收到此异常。有人知道如何管理它吗?

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

最佳答案

这个解决方案对 HttpClient request throws IOException 有帮助,尽管我们有不同的调用堆栈。

您需要在注册表中创建这些 key 。

路径:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework

键:

名称:“LegacyWPADSupport”类型:“dword”数据:00000000

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

键:

名称:“LegacyWPADSupport”类型:“dword”数据:00000000

关于c# - WebRequest.Create 抛出 IOException "The specified registry key does not exist.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15618163/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com