使用发布管道将.NET Core 3.0 API部署到Azure Web App
我正在尝试将我的API从.NET Core 2.2升级到3.0,但我无法让Azure Web应用程序实际运行使用3.0的应用程序 我的生成管道配置:使用发布管道将.NET Core 3.0 API部署到Azure Web App,azure,.net-core,azure-devops,azure-web-app-service,.net-core-3.0,Azure,.net Core,Azure Devops,Azure Web App Service,.net Core 3.0,我正在尝试将我的API从.NET Core 2.2升级到3.0,但我无法让Azure Web应用程序实际运行使用3.0的应用程序 我的生成管道配置: trigger: - master pool: vmImage: 'ubuntu-latest' variables: buildConfiguration: 'Release' steps: - task: UseDotNet@2 displayName: 'Use .NET Core 3' inputs: vers
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。一切顺利
我已经按照指示安装了预览扩展,并运行powershell命令测试路径D:\home\SiteExtensions\aspnetcorerRuntime.3.0.x86\
返回true
。但我仍然看到以下错误
回到Powershell,运行dotnet--version
和dotnet--list运行时
表明它只识别.NET Core 2运行时,尽管存在3.0运行时。据我所知,安装站点扩展不会更新使用新dotnet
版本的路径,而且Azure Devops部署任务似乎没有任何选项覆盖默认值。有没有人通过Azure DeVoPS发布管道部署了一个.NET核心3应用程序? < p>无论如何我不认为它是一个好的解决方案,但是我现在正在使用的解决方法是添加一个<代码> Web .CONFIG//C>文件,该文件通过完整的路径到代码扩展> dotnet < /COD> < /P>的站点扩展版本。
<?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>
我仍在寻找一个不那么容易出错的解决方案。我怀疑azure应用程序服务是否支持.Net Core 3.0@Venky声称如果使用站点扩展,他们会支持它:太好了!感谢您在此处分享您的解决方案,您可以接受它作为答案,这样它可以帮助其他遇到相同问题的社区成员,我们可以存档此线程,谢谢。@HughLin MSFT,但它是一个解决方案的黑客,MS声称支持3.0工作。