使用自定义nuget.config的webapp的nuget包恢复失败

问题描述 投票:1回答:1

我试图解决我有一个问题,我恢复nuget包为.net核心2.0 webapi有一个自定义包源。

基本上当包含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上对出站防火墙或代理进行了一些谷歌搜索并不富有成效。

azure azure-web-sites asp.net-core-2.0 azure-web-app-service kudu
1个回答
2
投票

因此,在研究和处理Kudu团队和Nuget团队之后,我们发现Azure WebApps在基本和自由层中具有有限数量的线程,并且当nuget恢复发生时,它以并行异步方式执行,并且它达到线程限制并且失败。

要修复,您必须在dotnet还原上使用--disable-parallel部署自定义部署脚本。

© www.soinside.com 2019 - 2024. All rights reserved.