Azure 无法部署 ASP.NET 核心应用程序/无法连接到 MyGet 服务器

Azure fails to deploy ASP.NET Core app / Can't connect to MyGet server

我对 .NET Core 有点陌生,我正在尝试制作一个 RESTful web api 带有身份验证(使用 OpenIddict 作为中间件)。我在 OSX.

上使用 Visual Studio 代码

要使用 OpenIddict,我必须为包添加另一个源,所以按照教程,我在项目的根目录下添加了一个 NuGet.config 文件,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <add key="aspnet-contrib" value="https://aspnetcontrib.myget.org/F/aspnet-contrib/api/v3/index.json" />
    </packageSources>
</configuration>

所以我恢复,我构建,我 运行,我用 Postman 尝试...很好!一切正常。因此,我尝试将其推送到 Azure 中。所以我设置了一个应用程序,将其源配置为本地 Git,然后推送我的应用程序。好

然后,Azure 尝试构建它,但在 运行 执行部署命令时失败,这是(我想)它获取包和所有内容的时间,对吧?那么,错误是:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restoring packages for D:\home\site\repository\BobWebApi.csproj...
  Restoring packages for D:\home\site\repository\BobWebApi.csproj...
  Restoring packages for D:\home\site\repository\BobWebApi.csproj...
  Restoring packages for D:\home\site\repository\BobWebApi.csproj...
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.extensions.secretmanager.tools/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.runtime.coreclr/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.dotnethostpolicy/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.csharp/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.codeanalysis.csharp/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.codeanalysis.visualbasic/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.extensions.platformabstractions/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.data.sqlite/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/libuv/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.visualstudio.web.codegeneration.tools/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/newtonsoft.json/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.aspnetcore.server.iisintegration/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/aspnet.security.oauth.validation/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.aspnetcore.authentication/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.app/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.platforms/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.visualbasic/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.entityframeworkcore.relational/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.aspnetcore.identity.entityframeworkcore/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/nuget.frameworks/index.json'.
  An error occurred while sending the request.
    The server returned an invalid or unrecognized response
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/runtime.native.system.io.compression/index.json'.
  An error occurred while sending the request.
    A connection with the server could not be established
  Retrying 'FindPackagesByIdAsync' for source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/runtime.native.system.io.compression/index.json'.
  An error occurred while sending the request.
    A connection with the server could not be established
D:\Program Files (x86)\dotnet\sdk.0.1\NuGet.targets(97,5): error : Failed to retrieve information about 'runtime.native.System.IO.Compression' from remote source 'https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/runtime.native.system.io.compression/index.json'. [D:\home\site\repository\BobWebApi.csproj]
D:\Program Files (x86)\dotnet\sdk.0.1\NuGet.targets(97,5): error :   An error occurred while sending the request. [D:\home\site\repository\BobWebApi.csproj]
D:\Program Files (x86)\dotnet\sdk.0.1\NuGet.targets(97,5): error :   A connection with the server could not be established [D:\home\site\repository\BobWebApi.csproj]
Failed exitCode=1, command=dotnet restore "BobWebApi.csproj"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu.60515.2845\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

所以我不知道该怎么办。为什么 Azure 甚至试图从错误的来源获取所有这些文件?如果必须,我该如何告诉它从哪里获取它们?

谢谢

抱歉耽误了。我设法通过从头开始重建、重新部署一切来解决一切。我没有找到快速解决它的解决方案,但由于我才刚刚开始,所以没什么大不了的。只是希望它不会再打击我。