如何让 Azure Kudu/Bitbucket 部署以将 .NET Core 控制台应用程序部署为 Web 作业?
How do I get Azure Kudu/Bitbucket deploy to deploy a .NET Core console app as a webjob?
阅读了此处的建议:https://docs.microsoft.com/en-gb/azure/app-service/webjobs-dotnet-deploy-vs#deploy-to-azure-app-service 我对通过 bitbucket/source 控件 link 将 .net 核心控制台应用程序部署为 webjob 的解决方案没有太大的感觉,因为那篇文章只谈到 "how to deploy a .net core app using Visual Studio's Publish To Azure" 和 "how to set up a .Net standard app for deployment [via bit bucket/source control integration] Via Azure kudu" - 我的情况似乎介于这两者之间?
我如何配置我的解决方案,其中包含我想 运行 作为 Web 的 Web 应用程序(部署良好且工作正常)和控制台应用程序(本地构建,不是在 Azure 上构建)工作?
目前,当我检查 Azure 上的构建日志时,看起来 kudu 甚至懒得构建 csproj,即使本地构建过程似乎构建了它:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restore completed in 803.97 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\ChatRoom.BL.DIExtension.csproj.
Restore completed in 118.75 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\ChatRoom.BL.Interfaces.csproj.
Restore completed in 111.72 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\ChatRoom.BL.Services.csproj.
Restore completed in 460.41 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\ChatRoom.SignalR.csproj.
Restore completed in 98.55 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\ChatRoom.BL.ViewModels.csproj.
Restore completed in 137.75 ms for D:\home\site\repository\ChatRoom\ChatRoom.Cache\ChatRoom.Cache.csproj.
Restore completed in 91.49 ms for D:\home\site\repository\ChatRoom\ChatRoom.Common\ChatRoom.Common.csproj.
Restore completed in 126.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\ChatRoom.DL.DIExtension.csproj.
Restore completed in 92.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\ChatRoom.DL.Entities.csproj.
Restore completed in 97.46 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\ChatRoom.DL.Interfaces.csproj.
Restore completed in 153.15 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\ChatRoom.DL.Repositories.csproj.
Restore completed in 109.98 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\ChatRoom.DL.UnitOfWork.csproj.
Restore completed in 12.85 ms for D:\home\site\repository\ChatRoom\ChatRoom.Localization\ChatRoom.Localization.csproj.
Restore completed in 76.23 ms for D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\ChatRoom.MessageBroker.csproj.
Restore completed in 215.29 ms for D:\home\site\repository\ChatRoom\ChatRoom.Replication\ChatRoom.Replication.csproj.
Restore completed in 189.31 ms for D:\home\site\repository\ChatRoom\ChatRoom.DrawingGenerator.Consumer\ChatRoom.DrawingGenerator.Consumer.csproj.
Restore completed in 1.2 sec for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Restore completed in 592.52 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 2.62 sec for D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\ChatRoom.BL.DIExtension.csproj.
Restore completed in 195.02 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\ChatRoom.BL.Interfaces.csproj.
Restore completed in 108.83 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\ChatRoom.BL.Services.csproj.
Restore completed in 359.89 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\ChatRoom.SignalR.csproj.
Restore completed in 97.73 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\ChatRoom.BL.ViewModels.csproj.
Restore completed in 103.01 ms for D:\home\site\repository\ChatRoom\ChatRoom.Cache\ChatRoom.Cache.csproj.
Restore completed in 83.57 ms for D:\home\site\repository\ChatRoom\ChatRoom.Common\ChatRoom.Common.csproj.
Restore completed in 161.88 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\ChatRoom.DL.DIExtension.csproj.
Restore completed in 91.2 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\ChatRoom.DL.Entities.csproj.
Restore completed in 89.98 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\ChatRoom.DL.Interfaces.csproj.
Restore completed in 108.06 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\ChatRoom.DL.Repositories.csproj.
Restore completed in 111.54 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\ChatRoom.DL.UnitOfWork.csproj.
Restore completed in 7.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.Localization\ChatRoom.Localization.csproj.
Restore completed in 82.28 ms for D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\ChatRoom.MessageBroker.csproj.
Restore completed in 178.2 ms for D:\home\site\repository\ChatRoom\ChatRoom.Replication\ChatRoom.Replication.csproj.
Restore completed in 834.91 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Restore completed in 328.17 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
ChatRoom.Cache -> D:\home\site\repository\ChatRoom\ChatRoom.Cache\bin\Release\netcoreapp2.2\ChatRoom.Cache.dll
ChatRoom.Common -> D:\home\site\repository\ChatRoom\ChatRoom.Common\bin\Release\netcoreapp2.2\ChatRoom.Common.dll
ChatRoom.DL.Entities -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\bin\Release\netcoreapp2.2\ChatRoom.DL.Entities.dll
ChatRoom.MessageBroker -> D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\bin\Release\netcoreapp2.2\ChatRoom.MessageBroker.dll
ChatRoom.BL.ViewModels -> D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\bin\Release\netcoreapp2.2\ChatRoom.BL.ViewModels.dll
ChatRoom.BL.Interfaces -> D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\bin\Release\netcoreapp2.2\ChatRoom.BL.Interfaces.dll
ChatRoom.DL.Interfaces -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\bin\Release\netcoreapp2.2\ChatRoom.DL.Interfaces.dll
ChatRoom.DL.Repositories -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\bin\Release\netcoreapp2.2\ChatRoom.DL.Repositories.dll
ChatRoom.Localization -> D:\home\site\repository\ChatRoom\ChatRoom.Localization\bin\Release\netstandard2.0\ChatRoom.Localization.dll
ChatRoom.Replication -> D:\home\site\repository\ChatRoom\ChatRoom.Replication\bin\Release\netcoreapp2.2\ChatRoom.Replication.dll
ChatRoom.BL.Services -> D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\bin\Release\netcoreapp2.2\ChatRoom.BL.Services.dll
ChatRoom.BL.DIExtension -> D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\bin\Release\netcoreapp2.2\ChatRoom.BL.DIExtension.dll
ChatRoom.SignalR -> D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\bin\Release\netcoreapp2.2\ChatRoom.SignalR.dll
ChatRoom.DL.UnitOfWork -> D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\bin\Release\netcoreapp2.2\ChatRoom.DL.UnitOfWork.dll
ChatRoom.DL.DIExtension -> D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\bin\Release\netcoreapp2.2\ChatRoom.DL.DIExtension.dll
ChatRoom -> D:\home\site\repository\ChatRoom\ChatRoom\bin\Release\netcoreapp2.2\ChatRoom.dll
ChatRoom -> D:\local\Tempd74117af5751d5\
Creating app_offline.htm
KuduSync.NET from: 'D:\local\Tempd74117af5751d5' to: 'D:\home\site\wwwroot'
Copying file: 'ChatRoom.BL.DIExtension.dll'
Copying file: 'ChatRoom.BL.DIExtension.pdb'
Copying file: 'ChatRoom.BL.Interfaces.dll'
Copying file: 'ChatRoom.BL.Interfaces.pdb'
Copying file: 'ChatRoom.BL.Services.dll'
Copying file: 'ChatRoom.BL.Services.pdb'
Copying file: 'ChatRoom.BL.ViewModels.dll'
Copying file: 'ChatRoom.BL.ViewModels.pdb'
Copying file: 'ChatRoom.Cache.dll'
Copying file: 'ChatRoom.Cache.pdb'
Copying file: 'ChatRoom.Common.dll'
Copying file: 'ChatRoom.Common.pdb'
Copying file: 'ChatRoom.deps.json'
Copying file: 'ChatRoom.DL.DIExtension.dll'
Copying file: 'ChatRoom.DL.DIExtension.pdb'
Copying file: 'ChatRoom.DL.Entities.dll'
Copying file: 'ChatRoom.DL.Entities.pdb'
Copying file: 'ChatRoom.DL.Interfaces.dll'
Copying file: 'ChatRoom.DL.Interfaces.pdb'
Copying file: 'ChatRoom.DL.Repositories.dll'
Copying file: 'ChatRoom.DL.Repositories.pdb'
Copying file: 'ChatRoom.DL.UnitOfWork.dll'
Copying file: 'ChatRoom.DL.UnitOfWork.pdb'
Copying file: 'ChatRoom.dll'
Copying file: 'ChatRoom.Localization.dll'
Copying file: 'ChatRoom.Localization.pdb'
Copying file: 'ChatRoom.MessageBroker.dll'
Copying file: 'ChatRoom.MessageBroker.pdb'
Copying file: 'ChatRoom.pdb'
Copying file: 'ChatRoom.Replication.dll'
Copying file: 'ChatRoom.Replication.pdb'
Copying file: 'ChatRoom.runtimeconfig.json'
Copying file: 'ChatRoom.SignalR.dll'
Copying file: 'ChatRoom.SignalR.pdb'
Copying file: 'ar-AE\ChatRoom.Localization.resources.dll'
Copying file: 'de-DE\ChatRoom.Localization.resources.dll'
Copying file: 'ru-Ru\ChatRoom.Localization.resources.dll'
Deleting app_offline.htm
Finished successfully.
它克隆将成为 webjob 的应用程序并为其恢复 nuget 包:
Restore completed in 189.31 ms for
D:\home\site\repository\ChatRoom\ChatRoom.DrawingGenerator.Consumer\ChatRoom.DrawingGenerator.Consumer.csproj
但之后就再也没有提到过,而且在 Azure 服务上也没有明显的该项目的二进制文件..
我希望我可以将它们配置为输出到按照惯例变成 Web 作业的文件夹集
How do I configure my solution, which contains a web app (deploys fine and works) and a console app (builds locally, isn't built on Azure) that I want to run as a web job?
我向 Azure WAS 构建的项目添加了一个 post 构建事件,形式为:
dotnet publish "%25DEPLOYMENT_SOURCE%25\MySolutionName\MyWebJobProject\MyWebJobProject.csproj" --output "%25DEPLOYMENT_TEMP%25\app_data\jobs\continuous\mywebjob" --configuration Release
%25
是必需的-> 当读取 csproj XML 时,它们解码为 %
,这意味着 %DEPLOYMENT_SOURCE%
被传递到命令行。如果您将 %DEPLOYMENT_SOURCE%
直接放入 VS 中的 Post Build Event GUI,则 %DE
将被解码为 0xDE,无论是什么字符,您都会在日志中看到错误替换字符 �
%DEPLOYMENT_SOURCE%
大概是D:\home\site\repository
。文件似乎在此根目录中构建,然后作为 DLL 发布到临时位置:
%DEPLOYMENT_TEMP%
类似于 D:\local\temp\abcdef1234
。在将 DLL 作为发布步骤移动到此处后,KuduSync.Net.exe 运行 将它们镜像回来
- KuduSync.Net.exe本质上是一个镜像工具;它从您的实时站点中删除上次部署但这次未部署的文件和目录,并添加这次部署但上次未部署的新文件。它不会触及未更改的文件。这样,如果您的站点创建了自己的文件(即不属于部署的一部分),那么它们就不会被丢弃
- 一旦您的 webjob 项目发布到 %DEPLOYMENT_TEMP% 位置,在
app_data\jobs\continuous\somename
子文件夹中,KuduSync 会将其同步回实时站点文件层次结构,并且它将出现在 webjobs 仪表板中
其中仅留下几行关于如何将 dotnet 控制台应用程序作为 Web 作业获取到 运行 的内容。最简单的路线似乎是:
- 将名为
run.bat
的文件添加到您的项目中,将其构建操作设置为 Content
并将输出文件夹复制到 Copy Always
- 在文件中放入
dotnet NameOfYourCoreApp.dll
使用纯 ASCII 编码保存文件,而不是 UTF8,否则字节顺序标记将构成第一行命令的一部分,您的应用程序将不会 运行
请记住,网络作业可以是不同类型的触发器;适当地编辑单词 "continuous"
Currently when I examine the build logs on Azure it looks like kudu doesn't even bother building the csproj
如果 azure 正在构建的 csproj 不依赖于它,那么它不会构建它。这无关紧要,因为正在构建的项目的 post 构建事件会构建未构建的项目。
阅读了此处的建议:https://docs.microsoft.com/en-gb/azure/app-service/webjobs-dotnet-deploy-vs#deploy-to-azure-app-service 我对通过 bitbucket/source 控件 link 将 .net 核心控制台应用程序部署为 webjob 的解决方案没有太大的感觉,因为那篇文章只谈到 "how to deploy a .net core app using Visual Studio's Publish To Azure" 和 "how to set up a .Net standard app for deployment [via bit bucket/source control integration] Via Azure kudu" - 我的情况似乎介于这两者之间?
我如何配置我的解决方案,其中包含我想 运行 作为 Web 的 Web 应用程序(部署良好且工作正常)和控制台应用程序(本地构建,不是在 Azure 上构建)工作?
目前,当我检查 Azure 上的构建日志时,看起来 kudu 甚至懒得构建 csproj,即使本地构建过程似乎构建了它:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restore completed in 803.97 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\ChatRoom.BL.DIExtension.csproj.
Restore completed in 118.75 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\ChatRoom.BL.Interfaces.csproj.
Restore completed in 111.72 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\ChatRoom.BL.Services.csproj.
Restore completed in 460.41 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\ChatRoom.SignalR.csproj.
Restore completed in 98.55 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\ChatRoom.BL.ViewModels.csproj.
Restore completed in 137.75 ms for D:\home\site\repository\ChatRoom\ChatRoom.Cache\ChatRoom.Cache.csproj.
Restore completed in 91.49 ms for D:\home\site\repository\ChatRoom\ChatRoom.Common\ChatRoom.Common.csproj.
Restore completed in 126.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\ChatRoom.DL.DIExtension.csproj.
Restore completed in 92.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\ChatRoom.DL.Entities.csproj.
Restore completed in 97.46 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\ChatRoom.DL.Interfaces.csproj.
Restore completed in 153.15 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\ChatRoom.DL.Repositories.csproj.
Restore completed in 109.98 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\ChatRoom.DL.UnitOfWork.csproj.
Restore completed in 12.85 ms for D:\home\site\repository\ChatRoom\ChatRoom.Localization\ChatRoom.Localization.csproj.
Restore completed in 76.23 ms for D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\ChatRoom.MessageBroker.csproj.
Restore completed in 215.29 ms for D:\home\site\repository\ChatRoom\ChatRoom.Replication\ChatRoom.Replication.csproj.
Restore completed in 189.31 ms for D:\home\site\repository\ChatRoom\ChatRoom.DrawingGenerator.Consumer\ChatRoom.DrawingGenerator.Consumer.csproj.
Restore completed in 1.2 sec for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Restore completed in 592.52 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 2.62 sec for D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\ChatRoom.BL.DIExtension.csproj.
Restore completed in 195.02 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\ChatRoom.BL.Interfaces.csproj.
Restore completed in 108.83 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\ChatRoom.BL.Services.csproj.
Restore completed in 359.89 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\ChatRoom.SignalR.csproj.
Restore completed in 97.73 ms for D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\ChatRoom.BL.ViewModels.csproj.
Restore completed in 103.01 ms for D:\home\site\repository\ChatRoom\ChatRoom.Cache\ChatRoom.Cache.csproj.
Restore completed in 83.57 ms for D:\home\site\repository\ChatRoom\ChatRoom.Common\ChatRoom.Common.csproj.
Restore completed in 161.88 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\ChatRoom.DL.DIExtension.csproj.
Restore completed in 91.2 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\ChatRoom.DL.Entities.csproj.
Restore completed in 89.98 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\ChatRoom.DL.Interfaces.csproj.
Restore completed in 108.06 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\ChatRoom.DL.Repositories.csproj.
Restore completed in 111.54 ms for D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\ChatRoom.DL.UnitOfWork.csproj.
Restore completed in 7.71 ms for D:\home\site\repository\ChatRoom\ChatRoom.Localization\ChatRoom.Localization.csproj.
Restore completed in 82.28 ms for D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\ChatRoom.MessageBroker.csproj.
Restore completed in 178.2 ms for D:\home\site\repository\ChatRoom\ChatRoom.Replication\ChatRoom.Replication.csproj.
Restore completed in 834.91 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
Restore completed in 328.17 ms for D:\home\site\repository\ChatRoom\ChatRoom\ChatRoom.csproj.
ChatRoom.Cache -> D:\home\site\repository\ChatRoom\ChatRoom.Cache\bin\Release\netcoreapp2.2\ChatRoom.Cache.dll
ChatRoom.Common -> D:\home\site\repository\ChatRoom\ChatRoom.Common\bin\Release\netcoreapp2.2\ChatRoom.Common.dll
ChatRoom.DL.Entities -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Entities\bin\Release\netcoreapp2.2\ChatRoom.DL.Entities.dll
ChatRoom.MessageBroker -> D:\home\site\repository\ChatRoom\ChatRoom.MessageBroker\bin\Release\netcoreapp2.2\ChatRoom.MessageBroker.dll
ChatRoom.BL.ViewModels -> D:\home\site\repository\ChatRoom\ChatRoom.BL.ViewModels\bin\Release\netcoreapp2.2\ChatRoom.BL.ViewModels.dll
ChatRoom.BL.Interfaces -> D:\home\site\repository\ChatRoom\ChatRoom.BL.Interfaces\bin\Release\netcoreapp2.2\ChatRoom.BL.Interfaces.dll
ChatRoom.DL.Interfaces -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Interfaces\bin\Release\netcoreapp2.2\ChatRoom.DL.Interfaces.dll
ChatRoom.DL.Repositories -> D:\home\site\repository\ChatRoom\ChatRoom.DL.Repositories\bin\Release\netcoreapp2.2\ChatRoom.DL.Repositories.dll
ChatRoom.Localization -> D:\home\site\repository\ChatRoom\ChatRoom.Localization\bin\Release\netstandard2.0\ChatRoom.Localization.dll
ChatRoom.Replication -> D:\home\site\repository\ChatRoom\ChatRoom.Replication\bin\Release\netcoreapp2.2\ChatRoom.Replication.dll
ChatRoom.BL.Services -> D:\home\site\repository\ChatRoom\ChatRoom.BL.Services\bin\Release\netcoreapp2.2\ChatRoom.BL.Services.dll
ChatRoom.BL.DIExtension -> D:\home\site\repository\ChatRoom\ChatRoom.BL.DIExtension\bin\Release\netcoreapp2.2\ChatRoom.BL.DIExtension.dll
ChatRoom.SignalR -> D:\home\site\repository\ChatRoom\ChatRoom.BL.SignalR\bin\Release\netcoreapp2.2\ChatRoom.SignalR.dll
ChatRoom.DL.UnitOfWork -> D:\home\site\repository\ChatRoom\ChatRoom.DL.UnitOfWork\bin\Release\netcoreapp2.2\ChatRoom.DL.UnitOfWork.dll
ChatRoom.DL.DIExtension -> D:\home\site\repository\ChatRoom\ChatRoom.DL.DIExtension\bin\Release\netcoreapp2.2\ChatRoom.DL.DIExtension.dll
ChatRoom -> D:\home\site\repository\ChatRoom\ChatRoom\bin\Release\netcoreapp2.2\ChatRoom.dll
ChatRoom -> D:\local\Tempd74117af5751d5\
Creating app_offline.htm
KuduSync.NET from: 'D:\local\Tempd74117af5751d5' to: 'D:\home\site\wwwroot'
Copying file: 'ChatRoom.BL.DIExtension.dll'
Copying file: 'ChatRoom.BL.DIExtension.pdb'
Copying file: 'ChatRoom.BL.Interfaces.dll'
Copying file: 'ChatRoom.BL.Interfaces.pdb'
Copying file: 'ChatRoom.BL.Services.dll'
Copying file: 'ChatRoom.BL.Services.pdb'
Copying file: 'ChatRoom.BL.ViewModels.dll'
Copying file: 'ChatRoom.BL.ViewModels.pdb'
Copying file: 'ChatRoom.Cache.dll'
Copying file: 'ChatRoom.Cache.pdb'
Copying file: 'ChatRoom.Common.dll'
Copying file: 'ChatRoom.Common.pdb'
Copying file: 'ChatRoom.deps.json'
Copying file: 'ChatRoom.DL.DIExtension.dll'
Copying file: 'ChatRoom.DL.DIExtension.pdb'
Copying file: 'ChatRoom.DL.Entities.dll'
Copying file: 'ChatRoom.DL.Entities.pdb'
Copying file: 'ChatRoom.DL.Interfaces.dll'
Copying file: 'ChatRoom.DL.Interfaces.pdb'
Copying file: 'ChatRoom.DL.Repositories.dll'
Copying file: 'ChatRoom.DL.Repositories.pdb'
Copying file: 'ChatRoom.DL.UnitOfWork.dll'
Copying file: 'ChatRoom.DL.UnitOfWork.pdb'
Copying file: 'ChatRoom.dll'
Copying file: 'ChatRoom.Localization.dll'
Copying file: 'ChatRoom.Localization.pdb'
Copying file: 'ChatRoom.MessageBroker.dll'
Copying file: 'ChatRoom.MessageBroker.pdb'
Copying file: 'ChatRoom.pdb'
Copying file: 'ChatRoom.Replication.dll'
Copying file: 'ChatRoom.Replication.pdb'
Copying file: 'ChatRoom.runtimeconfig.json'
Copying file: 'ChatRoom.SignalR.dll'
Copying file: 'ChatRoom.SignalR.pdb'
Copying file: 'ar-AE\ChatRoom.Localization.resources.dll'
Copying file: 'de-DE\ChatRoom.Localization.resources.dll'
Copying file: 'ru-Ru\ChatRoom.Localization.resources.dll'
Deleting app_offline.htm
Finished successfully.
它克隆将成为 webjob 的应用程序并为其恢复 nuget 包:
Restore completed in 189.31 ms for
D:\home\site\repository\ChatRoom\ChatRoom.DrawingGenerator.Consumer\ChatRoom.DrawingGenerator.Consumer.csproj
但之后就再也没有提到过,而且在 Azure 服务上也没有明显的该项目的二进制文件..
我希望我可以将它们配置为输出到按照惯例变成 Web 作业的文件夹集
How do I configure my solution, which contains a web app (deploys fine and works) and a console app (builds locally, isn't built on Azure) that I want to run as a web job?
我向 Azure WAS 构建的项目添加了一个 post 构建事件,形式为:
dotnet publish "%25DEPLOYMENT_SOURCE%25\MySolutionName\MyWebJobProject\MyWebJobProject.csproj" --output "%25DEPLOYMENT_TEMP%25\app_data\jobs\continuous\mywebjob" --configuration Release
%25
是必需的-> 当读取 csproj XML 时,它们解码为 %
,这意味着 %DEPLOYMENT_SOURCE%
被传递到命令行。如果您将 %DEPLOYMENT_SOURCE%
直接放入 VS 中的 Post Build Event GUI,则 %DE
将被解码为 0xDE,无论是什么字符,您都会在日志中看到错误替换字符 �
%DEPLOYMENT_SOURCE%
大概是D:\home\site\repository
。文件似乎在此根目录中构建,然后作为 DLL 发布到临时位置:%DEPLOYMENT_TEMP%
类似于D:\local\temp\abcdef1234
。在将 DLL 作为发布步骤移动到此处后,KuduSync.Net.exe 运行 将它们镜像回来- KuduSync.Net.exe本质上是一个镜像工具;它从您的实时站点中删除上次部署但这次未部署的文件和目录,并添加这次部署但上次未部署的新文件。它不会触及未更改的文件。这样,如果您的站点创建了自己的文件(即不属于部署的一部分),那么它们就不会被丢弃
- 一旦您的 webjob 项目发布到 %DEPLOYMENT_TEMP% 位置,在
app_data\jobs\continuous\somename
子文件夹中,KuduSync 会将其同步回实时站点文件层次结构,并且它将出现在 webjobs 仪表板中
其中仅留下几行关于如何将 dotnet 控制台应用程序作为 Web 作业获取到 运行 的内容。最简单的路线似乎是:
- 将名为
run.bat
的文件添加到您的项目中,将其构建操作设置为Content
并将输出文件夹复制到Copy Always
- 在文件中放入
dotnet NameOfYourCoreApp.dll
使用纯 ASCII 编码保存文件,而不是 UTF8,否则字节顺序标记将构成第一行命令的一部分,您的应用程序将不会 运行
请记住,网络作业可以是不同类型的触发器;适当地编辑单词 "continuous"
Currently when I examine the build logs on Azure it looks like kudu doesn't even bother building the csproj
如果 azure 正在构建的 csproj 不依赖于它,那么它不会构建它。这无关紧要,因为正在构建的项目的 post 构建事件会构建未构建的项目。