C# mono上的NuGet无法连接到internet
我有一台Linux机器在公司代理的后面 对于代理,我已设置CNTLM为我处理身份验证,因此我的代理位于。CNTLM连接到使用NTLMv2的公司代理 现在,当我尝试使用以下命令在Mono上运行Nuget时:C# mono上的NuGet无法连接到internet,c#,.net,linux,mono,nuget,C#,.net,Linux,Mono,Nuget,我有一台Linux机器在公司代理的后面 对于代理,我已设置CNTLM为我处理身份验证,因此我的代理位于。CNTLM连接到使用NTLMv2的公司代理 现在,当我尝试使用以下命令在Mono上运行Nuget时: mono.nuget/nuget.exe列表-详细详细信息-ConfigFile.nuget/nuget.Config 它给了我以下错误: System.TypeInitializationException:NuGet.ProxyCache的类型初始值设定项-->System.Argumen
mono.nuget/nuget.exe列表-详细详细信息-ConfigFile.nuget/nuget.Config
它给了我以下错误:
System.TypeInitializationException:NuGet.ProxyCache的类型初始值设定项-->System.ArgumentException:解析'*.intranet'-量词{x,y}时引发异常,后面没有任何内容。
位于:0中的System.Text.RegularExpressions.RegeParser.ScanRegex()[0x00000]处
在System.Text.RegularExpressions.RegeParser.Parse(System.String re,RegexOptions op)[0x00000]中:0
在System.Text.RegularExpressions.Regex..ctor(System.String模式、RegexOptions选项、TimeSpan匹配超时、布尔useCache)[0x00000]中:0
0中的System.Text.RegularExpressions.Regex..ctor(System.String模式)[0x00000]处
位于:0中的System.Net.WebProxy.CheckBypassList()[0x00000]
在System.Net.WebProxy..ctor(System.Uri地址,布尔值bypassOnLocal,System.String[]bypassList,ICredentials凭据)[0x00000]中:0
在System.Net.WebProxy..ctor(System.Uri地址,布尔bypassOnLocal,System.String[]bypassList)[0x00000]中:0
位于:0中的System.Net.WebRequest.GetSystemWebProxy()[0x00000]处
在:0中的NuGet.ProxyCache..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
在:0中的NuGet.HttpClient.GetResponse()[0x00000]处
在:0中的NuGet.RedirectedHttpClient.GetResponseUri(NuGet.HttpClient客户端)[0x00000]处
在:0中的NuGet.RedirectedHttpClient.EnsureClient()[0x00000]处
位于:0中的System.Lazy
1[System.Object].CreateValue()[0x00000]处
`
它似乎想要解析一个“*.intranet”字符串,尽管我不确定它是从哪里得到的。我的Nuget.Config文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<config>
<add key="http_proxy" value="http://localhost:3128" />
</config>
</configuration>
我将其添加到Mono/etc/Mono/[2.0,4.0,4.5]/machine.config文件中
<configuration>
<system.net>
<defaultProxy>
<proxy proxyadress="http://localhost:3128" />
</defaultProxy>
</system.net>
</configuration>
然而,这并没有产生任何效果。我也无法运行
mozroots
,但我通过下载文件并使用文件选项手动导入文件来避免这种情况。我认为这可能与此相关。Mono将查找无代理或无代理环境变量来生成代理的旁路列表
因此,值得检查该环境变量,以查看它是否正在使用*。intranet并导致异常是否设置了无代理或无代理环境变量?查看Mono源代码,它使用no_proxy环境变量生成旁路列表。就是这样,如果您将其添加为答案,我可以将其标记为正确