Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 将ASP.NET Core部署到AWS Elastic Beanstalk,必须包含带有';的文件;。runtimeconfig.json';后缀错误_Amazon Web Services_Asp.net Core_Deployment_Amazon Elastic Beanstalk - Fatal编程技术网

Amazon web services 将ASP.NET Core部署到AWS Elastic Beanstalk,必须包含带有';的文件;。runtimeconfig.json';后缀错误

Amazon web services 将ASP.NET Core部署到AWS Elastic Beanstalk,必须包含带有';的文件;。runtimeconfig.json';后缀错误,amazon-web-services,asp.net-core,deployment,amazon-elastic-beanstalk,Amazon Web Services,Asp.net Core,Deployment,Amazon Elastic Beanstalk,我正在尝试使用Bitbucket管道将ASP.NET Core(dotnet 5.0版)部署到AWS Elastic Beanstalk,但部署步骤导致错误:实例部署:您的源捆绑包只有一个.NET Core应用程序。必须包含后缀为“.runtimeconfig.json”的文件。部署失败 弹性豆茎设置: 平台:.NET内核在Linux上 平台分支:。在64位Amazon Linux 2上运行的NET Core 平台版本:2.1.0(推荐) (使用#某些#文本更改敏感数据) 弹性豆茎原木: 2

我正在尝试使用Bitbucket管道将ASP.NET Core(dotnet 5.0版)部署到AWS Elastic Beanstalk,但部署步骤导致错误:实例部署:您的源捆绑包只有一个.NET Core应用程序。必须包含后缀为“.runtimeconfig.json”的文件。部署失败

弹性豆茎设置:

  • 平台:.NET内核在Linux上
  • 平台分支:。在64位Amazon Linux 2上运行的NET Core
  • 平台版本:2.1.0(推荐)
(使用#某些#文本更改敏感数据)

弹性豆茎原木:

2020-12-04 02:04:16 UTC+0100 ERROR During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
2020-12-04 02:04:16 UTC+0100 ERROR Failed to deploy application.
2020-12-04 02:04:16 UTC+0100 ERROR Unsuccessful command execution on instance id(s) '#id'. Aborting the operation.
2020-12-04 02:04:16 UTC+0100 INFO  Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-12-04 02:04:16 UTC+0100 ERROR [Instance: #id] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2020-12-04 02:04:13 UTC+0100 ERROR Instance deployment: Your source bundle has a single .NET Core application. You must include a file with a '.runtimeconfig.json' suffix. The deployment failed.
2020-12-04 02:04:13 UTC+0100 INFO  Instance deployment found a runtime-dependent .NET Core application in your source bundle.
2020-12-04 02:04:13 UTC+0100 ERROR Instance deployment failed. For details, see 'eb-engine.log'.
2020-12-04 02:04:10 UTC+0100 INFO  Deploying new version to instance(s).
eb-engine.log:

2020/12/04 01:04:13.566295 [INFO] Executing instruction: StageApplication
2020/12/04 01:04:13.569996 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2020/12/04 01:04:13.570035 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2020/12/04 01:04:13.688429 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2020/12/04 01:04:13.689890 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2020/12/04 01:04:13.689914 [INFO] The dir .platform/hooks/prebuild/ does not exist in the application. Skipping this step...
2020/12/04 01:04:13.689920 [INFO] Executing instruction: CheckProcfileForDotNetCoreApplication
2020/12/04 01:04:13.689925 [INFO] checking application and updating executable file permissions...
2020/12/04 01:04:13.690272 [INFO] found runtime-dependent application...
2020/12/04 01:04:13.690294 [INFO] checking Procfile...
2020/12/04 01:04:13.690317 [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: there is no .runtimeconfig.json file for your single application. Please provide a valid application
比特桶管道: (缩短-仅相关步骤)

从日志中,AWS似乎找不到后缀为“.runtimeconfig.json”的文件,但它位于zip文件中: (目录打印屏幕)

到目前为止,我已经尝试从Bitbucket管道和我的笔记本电脑部署该应用程序。我甚至尝试过部署自包含构建,但在相同的错误中解决了这个问题。我的一位同事使用VisualStudioElasticBeanstalk部署工具成功地部署了它,但这并不能解决我们的问题,它只是一个临时修复。我尝试添加Procfile,但没有效果


我还没有找到弹性豆茎的配置吗?任何想法和建议都将不胜感激。

我无法以“管道”的方式工作,但我使用了管道。管道现在看起来像这样:

image: mcr.microsoft.com/dotnet/sdk:5.0

pipelines:
    test:
      - step:
          name: "Create a release of Api project"
          script:
            - export API_PROJ=path/to/my/project.csproj
            - export CONFIG=Release
            - dotnet publish -c $CONFIG $API_PROJ -o api
          artifacts:
            - api/**
      - step:
          name: "Deploy"
          script:
            - apt update
            - apt install -y zip
            - dotnet tool install -g Amazon.ElasticBeanstalk.Tools
            - export PATH="$PATH:/root/.dotnet/tools"
            - dotnet eb deploy-environment
              --aws-access-key-id $AWS_ACCESS_KEY_ID
              --aws-secret-key $AWS_SECRET_ACCESS_KEY
              -pl path/to/my/
              -f net5.0
              --region eu-west-2
              -app #the_app
              -env $BITBUCKET_BRANCH
              --solution-stack '64bit Amazon Linux 2 v2.1.0 running .NET Core'
              --instance-profile #my_role
              --instance-type t2.micro

这是因为EB在根目录上查找
runtimeconfig.json
。如果您解压缩zip,您将拥有如下目录结构-

randomName.zip > random name created by EB
  api
    -runtimeconfig.json
    -
虽然它看起来像

{randomName.zip} > random name created by EB
  -runtimeconfig.json

因此,将buildspec工件更改为
api/**
/**
应该可以。下面是我在Github上的工作示例-

,因此本教程是错误的-很有趣
{randomName.zip} > random name created by EB
  -runtimeconfig.json