简体   繁体   English

将 .net core 3.1 Web 应用部署到 Azure Linux 应用服务

[英]Deploying .net core 3.1 web app to Azure Linux App Service

I've set up the release in Azure Devops to deploy a .net core 3.1 app to a Linux App Service in Azure.我已在 Azure Devops 中设置了该版本,以将 .net core 3.1 应用程序部署到 Azure 中的 Linux 应用服务。 This seems to push the code to Azure, but to a really weird path:这似乎将代码推送到 Azure,但到了一条非常奇怪的路径:

Index of /wwwroot/Content/d_C/a/1/s/[MyProject]/obj/Release/netcoreapp3.1/PubTmp/Out/ /wwwroot/Content/d_C/a/1/s/[MyProject]/obj/Release/netcoreapp3.1/PubTmp/Out/索引

This contains all the dlls and then a wwwroot directory which has all the files & folders found in my web project.这包含所有 dll,然后是一个 wwwroot 目录,其中包含在我的 Web 项目中找到的所有文件和文件夹。

Here is my Release set up .这是我的发布设置 Anyone have any ideas why my release isn't publishing to /home/site/wwwroot/?任何人都知道为什么我的版本没有发布到 /home/site/wwwroot/? Others have said that this is where the site should be published to.其他人说这是网站应该发布到的地方。 Is there something I need to set up in the Azure portal or is this a Devops thing?我需要在 Azure 门户中设置一些东西还是 Devops 的东西?

This wired path should not relevant with the configuration of Azure app service deploy task or Azure portal (Just ensure the Physical path value in Azure portal is site/wwwroot ) .此有线路径不应与 Azure 应用服务部署任务或 Azure 门户的配置相关(只需确保Azure 门户中Physical path值为site/wwwroot

I guess you were using Visual studio build task to build your project, right?我猜您正在使用Visual studio build task来构建您的项目,对吗? Because I faced the similar path structure if I use VSbuild task to build my .net core app.因为如果我使用VSbuild任务来构建我的.net core应用程序,我会面临类似的路径结构。 If yes, what the others told you is correct.如果是的话,其他人告诉你的是正确的。 This is the default action if you are using Visual studio build task in Build pipeline.如果您在构建管道中使用Visual studio build task ,则这是默认操作。

Others have explained this in detail, also provided the corresponding solution.其他人对此进行了详细解释,也提供了相应的解决方案。 You can refer to this #1 for explanation of this default action.您可以参考此#1以了解此默认操作的说明。 And check this #2 for work around.并检查此#2以解决问题。

Therefore I can safely assume that you are developing ASP.NET Core 3.0 app to be hosted in Ubuntu.因此,我可以放心地假设您正在开发要在 Ubuntu 中托管的 ASP.NET Core 3.0 应用程序。 Any .NET Core 3.0 (or later) application means that you should rely on the dotnet build instead of using VSBuild.任何 .NET Core 3.0(或更高版本)应用程序都意味着您应该依赖dotnet build而不是使用 VSBuild。

Also you had stated that you will host the app on Ubuntu 18.x, then you should also run the build on Azure DevOps agent that runs on Ubuntu.此外,您还表示您将在 Ubuntu 18.x 上托管应用程序,那么您还应该在 Ubuntu 上运行的 Azure DevOps 代理上运行构建。 This means you should only use dotnet build in DotNetCoreCLI@2 task, because VSBuild task only runs on Windows based agent, not Ubuntu and it is intended to compile .NET Framework and other platform other than .NET Core.这意味着你应该只在DotNetCoreCLI@2任务中使用dotnet build ,因为VSBuild任务只在基于 Windows 的代理上运行,而不是在 Ubuntu 上运行,它旨在编译 .NET Framework 和其他平台而不是 .NET Core。

So, to achieve what you want, here you need using dotnet build task to build your .net core 3.1 project.所以,为了实现你想要的,这里你需要使用dotnet build 任务来构建你的.net core 3.1项目。

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    command: 'build'
    projects: PATH/TO/YOUR/Project.csproj
    arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 Azure Devops 将 .Net Core 3.1 Web 应用程序部署到 Azure Linux Web 服务时出错 - Error Deploying .Net Core 3.1 Web App to Azure Linux Web Service through Azure Devops 将.net Core Web应用程序部署到ubuntu linux - Deploying .net Core web app to ubuntu linux Azure 发布管道发布到 NetCore 3.1 linux 应用服务失败,退出代码为 145 - '无法在日志中找到任何 .NET 核心 SDK' - Azure release pipeline publish to NetCore 3.1 linux app service fails with exit code 145 - 'Not possible to find any .NET Core SDKs' in log Azure Web 应用程序中的库错误(Linux 上的 Net Core) - Errors with Library in Azure Web App (Net Core on Linux) Linux上的.Net Core控制台应用程序不会作为服务运行 - .Net Core console app on Linux will not run as service 通过Azure Devops将Docker镜像部署到Linux上的Web应用程序失败 - Deploying docker image to web app on Linux via Azure Devops fails Azure Linux 带有 .Net Core Stack 的应用服务。 无法使用 NodeJS - Azure Linux App Service with .Net Core Stack. Unable to use NodeJS 如何在单个基于 linux 的 azure 应用服务中部署多个 .net 核心应用程序 - how to deploy multiple .net core application in single linux based azure app service SQL 连接来自 Azure Linux 应用服务 Z2567A5EC9705EB7AC2C98409DZE0 - SQL Connection from Azure Linux App Service web app 我可以在Linux平台上构建.net-core应用程序,然后再部署到Azure Web应用程序吗 - Can I build my .net-core application on a linux platform, then deploy to an azure web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM