已在此处阅读建议:https://docs.microsoft.com/en-gb/azure/app-service/webjobs-dotnet-deploy-vs#deploy-to-azure-app-service,对于通过bitbucket /源代码控制链接将.net核心控制台应用程序部署为webjob的解决方案,我的看法并不明显,因为该文章仅谈到“如何使用Visual Studio的“发布到Azure”来部署.net核心应用程序”和“如何通过Azure kudu [通过位存储桶/源代码控制集成]设置用于部署的.Net标准应用程序”-我的情况似乎介于两者之间? / p>
如何配置我的解决方案,该解决方案包含一个要作为Web作业运行的Web应用程序(可以正常部署并且可以正常工作)和一个控制台应用程序(本地构建,而不是在Azure上构建)?
当前,当我在Azure上检查构建日志时,即使本地构建过程似乎在构建kusproj,kudu都不会打扰它:
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\Temp\8d74117af5751d5\
Creating app_offline.htm
KuduSync.NET from: 'D:\local\Temp\8d74117af5751d5' 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作业的文件夹集
答案 0 :(得分:0)
如何配置我的解决方案,该解决方案包含一个要作为Web作业运行的Web应用程序(可以正常部署并且可以正常工作)和一个控制台应用程序(本地构建,而不是在Azure上构建)?
我向Azure WAS构建的项目添加了一个构建后事件,格式为:
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,无论是什么字符,并且您会在日志中看到带有替换字符的错误。 / p>
%DEPLOYMENT_SOURCE%
可能是D:\home\site\repository
。文件似乎在此根目录中构建,然后以DLL的形式发布到临时位置:%DEPLOYMENT_TEMP%
类似于D:\local\temp\abcdef1234
。在将DLL作为发布步骤移动到此处之后,KuduSync.Net.exe将运行并镜像回它们。app_data\jobs\continuous\somename
子文件夹中,KuduSync会将其同步回实时站点文件层次结构,并将出现在webjobs仪表板中关于如何使dotnet控制台应用程序作为Webjob运行仅剩几行内容。最简单的路线似乎是:
run.bat
的文件,将其“构建操作”设置为Content
,并将“复制到输出文件夹”设置为Copy Always
dotnet NameOfYourCoreApp.dll
使用纯ASCII编码而不是UTF8保存文件,否则字节顺序标记将成为命令第一行的一部分,并且您的应用将无法运行
请记住,网络作业可以是不同类型的触发器;适当地编辑“连续”一词
当前,当我在Azure上检查构建日志时,似乎kudu甚至都不会去构建csproj
如果azure IS构建的csproj不依赖于它,则它将不构建它。没关系,因为IS正在构建的项目上的post build事件会构建未构建的项目。