我正在尝试修复我的问题,即恢复具有自定义包源的.net core 2.0 webapi的nuget包。
基本上,当包含nuget.config时,任何微软软件包都无法安装,因为它似乎忽略了我的nuget引用。
我找到了一个解决方法,即删除我的自定义nuget.config,让构建失败,一旦失败,它将从nuget.org下载正确的东西,然后通过添加自定义文件,它将从磁盘恢复那些微软软件包然后到达以获取我的自定义nuget软件包。
我的nuget Package配置如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="ASPNET Team" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="OTL" value="https://www.myget.org/F/{redacted}/api/v3/index.json" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
<disabledPackageSources />
</configuration>
Kudu的错误是:
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.hosting.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.entityframeworkcore.tools/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.dependencyinjection.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://dotnetmyget.blob.core.windows.net/artifacts/aspnetcore-ci-dev/nuget/v3/flatcontainer/microsoft.extensions.dependencyinjection.abstractions/index.json'.
An error occurred while sending the request.
A connection with the server could not be established
Retrying 'FindPackagesByIdAsync' for source 'https://www.myget.org/F/{redacted}/api/v3/flatcontainer/microsoft.extensions.caching.sqlserver/index.json'.
直接从Kudu控制台执行dotnet恢复会产生相同的结果。我从我的开发机器中取出了NuGet.config,我知道它已经成功恢复了微软软件包和自定义软件包,并试图使用它并且它仍然失败。
我开始认为它的出站端口阻止了azure中的防火墙事件,但是在webapp上对出站防火墙或代理进行了一些谷歌搜索并不富有成效。
答案 0 :(得分:2)
因此,在研究和处理Kudu团队和Nuget团队之后,我们发现Azure WebApps在基本和自由层中的线程数量有限,并且当nuget恢复发生时,它以并行异步方式执行,并且它达到了线程限制并失败。
要修复,您必须在dotnet还原上使用--disable-parallel部署自定义部署脚本。