【问题标题】:Container xx didn't respond to HTTP pings on port: 8080, failing site start or Unable to bind to http://localhost:5000 on the IPv6 loopback interface容器 xx 未响应端口上的 HTTP ping:8080、站点启动失败或无法绑定到 IPv6 环回接口上的 http://localhost:5000
【发布时间】:2020-09-16 15:26:36
【问题描述】:

我已经多次使用 FTP 部署我的应用程序,并且一直工作到现在。我没有使用 docker,所以我想 azure 在我上传文件后正在对我的应用程序进行 docker 化。 我收到两个错误,我不确定是否与端口、我的 lunchsettings.json、我的启动项目有关... 我正在使用 net core 3.1 和 angular 6。

我尝试将 PORT、ASPNETCORE_URLS...和其他变量添加到 Azure 应用程序设置...

这里是错误:

来自 Azure 的日志:诊断和解决问题:应用程序日志

2020-05-29T05:34:18.801Z 信息 - 站点的启动容器 2020-05-29T05:34:18.802Z 信息 - docker run -d -p 6115:8080 --name upisite_0_99ae64d5 -e WEBSITE_SITE_NAME=Upisite -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=upisite.azurewebsite .net -e WEBSITE_INSTANCE_ID=cdbb42914fa53f4972f5e7c6469f3e4ef2f3e5cb1017cfc16cde43debbb77243 appsvc/dotnetcore:3.1-latest_20200101.1

2020-05-29T05:34:18.805Z 信息 - 此容器未启用日志记录。 请使用https://aka.ms/linux-diagnostics 启用日志记录以在此处查看容器日志。 2020-05-29T05:37:18.731Z 信息 - 等待对容器 upisite_0_99ae64d5 的预热请求的响应。经过时间 = 178.6585207 秒 2020-05-29T05:37:33.866Z 信息 - 等待对容器 upisite_0_99ae64d5 的预热请求的响应。经过时间 = 193.7941907 秒 2020-05-29T05:37:51.054Z 信息 - 等待对容器 upisite_0_99ae64d5 的预热请求的响应。经过时间 = 210.9819339 秒 2020-05-29T05:38:06.216Z 信息 - 等待对容器 upisite_0_99ae64d5 的预热请求的响应。经过时间 = 226.14369 秒 2020-05-29T05:38:15.145Z 错误 - 用于站点 upisite 的容器 upisite_0_99ae64d5 未在预期时限内启动。经过时间 = 235.0733223 秒 **2020-05-29T05:38:15.154Z 错误 - 容器 upisite_0_99ae64d5 未响应端口:8080 上的 HTTP ping,站点启动失败。查看容器日志以进行调试。 2020-05-29T05:38:15.175Z 信息 - 停止站点 upisite,因为它在启动期间失败。**

来自 Azure 的日志:诊断和解决问题:容器崩溃

2020-06-01T16:54:06.752807040Z [40m[1m[33mwarn[39m[22m[49m:Microsoft.AspNetCore.Server.Kestrel[0] 2020-06-01T16:54:06.752872042Z 无法绑定到 IPv6 环回接口上的 http://localhost:5000:“无法分配请求的地址”。 2020-06-01T16:54:06.806104175Z 2020-06-01 16:54:06.7760|WARN|Microsoft.AspNetCore.Server.Kestrel|无法绑定到 IPv6 环回接口上的http://localhost:5000:'无法分配请求的地址”。 2020-06-01T16:54:06.998607188Z 2020-06-01 16:54:06.9983|INFO|Microsoft.Hosting.Lifetime|现在收听:http://localhost:5000

小米程序类

public static void Main(string[] args)
        {
            // ASP.NET Core 3.0+:
            // The UseServiceProviderFactory call attaches the
            // Autofac provider to the generic hosting mechanism.
            var host = Host.CreateDefaultBuilder(args)
                .ConfigureLogging(logging =>
                {
                    logging.ClearProviders();
                    logging.AddConsole();
                })
                .UseServiceProviderFactory(new AutofacServiceProviderFactory())
                .ConfigureWebHostDefaults(webHostBuilder => {
                    webHostBuilder
              .UseContentRoot(Directory.GetCurrentDirectory())
              .UseIISIntegration()
              .UseStartup<Startup>();
                })
                .Build();
            host.Run();
        }

* 小米启动类 *

 public Startup(IWebHostEnvironment env)
        {
            var builder = new ConfigurationBuilder()
        .SetBasePath(env.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
        .AddEnvironmentVariables();
            this.Configuration = builder.Build();
        }

* Mi lunchsettings.json *

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:5000",
      "sslPort": 0
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

【问题讨论】:

  • 您的问题解决了吗?你找到解决办法了吗?
  • @Jason 我添加了更多细节。

标签: asp.net-core azure-devops asp.net-core-webapi azure-web-app-service kestrel-http-server


【解决方案1】:

Azure Web 应用仅支持端口 80 和 443。有关详细信息,您可以查看 post1post2

我可以看到包含port 8080 的错误。我想这可能是错误的原因,您可以检查一下。

如果您需要使用port 8080,您可以使用云服务或虚拟机。

【讨论】:

  • 谢谢。我尝试更改或添加 azure 应用程序设置,很幸运。我添加了更多细节。
  • @FelipeRojoAmadeo 我建议设置你的 applicationUrl: http://yourappname.azure.websites.net(:80) or https://yourappname.azure.websites.net(:443) ,然后进行测试。
  • 它不起作用...我仍然收到“无法在 IPv6 环回接口上绑定到 localhost:5000:'无法分配请求的地址'。”我不知道它从哪里获取端口 5000 ......另外“容器 xx 没有响应端口:8080 上的 HTTP ping”。我的 applicationUrl: "iisExpress": { "applicationUrl": "upisite.azurewebsites.net/;https://upisite.azurewebsites.net", "sslPort": 0 }
猜你喜欢
  • 1970-01-01
  • 2021-08-04
  • 1970-01-01
  • 2020-04-26
  • 1970-01-01
  • 1970-01-01
  • 2021-04-26
  • 1970-01-01
相关资源
最近更新 更多