【问题标题】:unable to access the web api after published to Beanstalk AWS发布到 Beanstalk AWS 后无法访问 web api
【发布时间】:2020-11-27 08:37:06
【问题描述】:

我已将我的 web api 应用程序从 Visual Studio 发布到 AWS Beanstalk,但是我无法访问我的应用程序,并且出现如下图所示的错误。

AWS Beanstalk 配置如下:

  {
    "comment" : "This file is used to help set default values when using the dotnet CLI extension 
    Amazon.ElasticBeanstalk.Tools. For more information run \"dotnet eb --help\" from the project 
    root.",
   "profile" : "default",
   "region"  : "ca-central-1",
   "application" : "eBookCatalog",
  "environment" : "eBookCatalog-dev",
  "cname"       : "ebookcatalog-dev",
  "solution-stack" : "64bit Windows Server Core 2016 v2.6.0 running IIS 10.0",
  "environment-type" : "SingleInstance",
  "instance-profile" : "aws-elasticbeanstalk-ec2-role",
  "service-role"     : "aws-elasticbeanstalk-service-role",
  "health-check-url" : "/",
  "instance-type"    : "t2.micro",
  "key-pair"         : "eBookCatalog",
  "iis-website"      : "Default Web Site",
  "app-path"         : "/",
  "enable-xray"      : false
 }

环境状态如下图:

【问题讨论】:

    标签: amazon-web-services asp.net-web-api amazon-elastic-beanstalk


    【解决方案1】:

    这不是 EB 问题,而是您的申请。例如,如果您使用curl 仔细检查它,您会收到来自Microsoft-IIS/10.0 服务器的响应。所以连接按预期工作。也许您的应用程序需要一个路径,ebookcatalog-dev.ca-central-1.elasticbeanstalk.com/api,或者它被其他一些非默认方式调用。

    curl -i ebookcatalog-dev.ca-central-1.elasticbeanstalk.com
    
    HTTP/1.1 404 Not Found
    Transfer-Encoding: chunked
    Server: Microsoft-IIS/10.0
    X-Powered-By: ASP.NET
    

    【讨论】:

    • 确实如此。您知道我是否可以将 Elastic Beanstalk 中的“ebookcatalog-dev.ca-central-1.elasticbeanstalk.com/”更改为“ebookcatalog-dev.ca-central-1.elasticbeanstalk.com/api”?现在我只能通过添加“/api”来获得正确的网址
    • @Tasneem 遗憾的是,我不太了解Microsoft-IIS/10.0,无法建议如何为不同的路径更改它。
    • 非常感谢您的回复。我会搜索的。
    猜你喜欢
    • 2019-10-01
    • 2019-06-27
    • 2019-09-18
    • 2019-05-10
    • 2021-10-31
    • 2013-06-04
    • 1970-01-01
    • 2019-04-20
    • 2015-06-03
    相关资源
    最近更新 更多