我正在尝试将 API 从 .NET Core 2.2 升级到 3.0,但无法让 Azure Web App 使用 3.0 实际运行应用程序。
我的构建管道配置:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core 3'
inputs:
version: 3.x
- script: dotnet tool install --global dotnet-ef
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: efcore-migration-script-generator-task@0
inputs:
projectpath: 'Models/Models.csproj'
databasecontexts: 'DataContext'
startupprojectpath: 'Api/Api.csproj'
targetfolder: '$(build.artifactstagingdirectory)/migrations'
- script: dotnet publish --output $(Build.ArtifactStagingDirectory)
displayName: 'dotnet publish $(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
然后,我有一个多阶段发布管道,使用以下命令将工件发布到 Azure:Azure App Service Deploy
任务。一切都运行没有问题
我已按照指示安装了预览扩展,并运行 powershell 命令Test-Path D:\home\SiteExtensions\AspNetCoreRuntime.3.0.x86\
回报true
。但我仍然看到以下错误。
ANCM 无法找到本机依赖项 https://i.stack.imgur.com/4jUme.png
回到Powershell,运行dotnet --version
and dotnet --list-runtimes
显示它仅识别 .NET Core 2 运行时,尽管存在 3.0 运行时。据我所知,安装站点扩展不会更新使用新版本的路径dotnet
版本,并且 Azure Devops 部署任务似乎没有任何选项来覆盖默认值。有没有人设法通过 Azure Devops Release Pipelines 部署 .NET Core 3 应用程序?
无论如何,我不认为这是一个好的解决方案,但我现在正在使用的解决方法是添加一个web.config
将完整路径传递到站点扩展版本的文件dotnet
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="D:\home\SiteExtensions\AspNetCoreRuntime.3.0.x86\dotnet" arguments=".\Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
我仍在寻找一种不太容易出错的解决方案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)