【发布时间】:2022-11-24 07:44:30
【问题描述】:
我有一个 AWS CodePipeline 进程,它获取 CodeCommit 存储库构建应用程序并将应用程序发布到 Linux EC2 实例。整个过程成功执行,我可以看到最终的 asp.net 核心应用程序已发布到 /var/www/html/ 文件夹。但是当我加载负载均衡器的 URL(EC2 实例在负载均衡器后面)时,我看到的是 Apache 测试页面,而不是 asp.net 核心应用程序。
我创建的 asp.net core 应用程序只是默认创建的默认 asp.net core web 应用程序。
下面是 buildspec.yaml 文件。 (这发布了一个独立的应用程序)
version: 0.2
env:
variables:
DOTNET_CORE_RUNTIME: 6.0
phases:
install:
on-failure: ABORT
runtime-versions:
dotnet: ${DOTNET_CORE_RUNTIME}
commands:
- echo install stage - started `date`
pre_build:
commands:
- echo pre build stage - stared `date`
- echo restore dependencies started `date`
- dotnet restore ./WebApplication1/WebApplication1.csproj
build:
commands:
- echo build stage - started `date`
- dotnet publish --configuration Release --runtime linux-x64 ./WebApplication1/WebApplication1.csproj --self-contained
- cp ./WebApplication1/appspec.yml ./WebApplication1/bin/Release/net6.0/linux-x64/publish/
artifacts:
files:
- '**/*'
- appspec.yml
name: artifact-test-cham
discard-paths: no
base-directory: ./WebApplication1/bin/Release/net6.0/linux-x64/publish/
下面是将内容从 S3 工件位置复制到 /var/www/html/ 文件夹的 appspec.yaml 文件
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html/
下图显示 Web 应用程序与其他 asp.net 核心框架相关文件成功发布到 Linux EC2 实例中的 /var/www/html 文件夹。但是,即使所有 Web 应用程序文件以及其他框架文件都可用,正如我所说,当我浏览负载均衡器时,我只能看到 Apache 测试页面。
【问题讨论】:
标签: asp.net-core .net-core amazon-ec2 aws-codepipeline asp.net-core-6.0