将Windows服务发布为AZURE WEBJOB

时间:2017-02-27 10:01:10

标签: azure nservicebus webjob

我有一个NserviceBus处理程序,它通常作为服务安装在VM上。我们正试图将此作为PAAS在Azure上运行。因此,我们的想法是将解决方案发布为天蓝色的webjob。当我将其作为Web作业发布时,我将获得一个待处理的启动状态。日志表明以下内容。

[02/27/2017 09:35:10 > 2cf107: SYS INFO] Run script 'ENSource.Handlers.exe' with script host - 'WindowsScriptHost'
[02/27/2017 09:35:10 > 2cf107: SYS INFO] Status changed to Running
[02/27/2017 09:35:10 > 2cf107: INFO] Cannot start service from the command line or a debugger.  A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
[02/27/2017 09:35:10 > 2cf107: SYS INFO] Status changed to Success
[02/27/2017 09:35:10 > 2cf107: SYS INFO] Process went down, waiting for 60 seconds
[02/27/2017 09:35:10 > 2cf107: SYS INFO] Status changed to PendingRestart

我错过了什么?如何让NServiceBus处理程序在Azure上作为WebJobs工作?

2 个答案:

答案 0 :(得分:0)

它不能使用Azure Web Jobs,您可以尝试使用提升的权限将其作为云服务运行,但我不确定它是否会授予您将其作为Windows服务安装的权限。因此,我担心没有别的办法,而不是使用虚拟机。如果您想要PaaS替代方案,可以尝试使用Azure Service Bus重写此应用程序。

答案 1 :(得分:0)

我只是重写服务,因此它不再是Windows服务而是控制台应用程序。然后,您可以将WebJob主机告诉run it on a schedule(如果对您的方案更有意义,可以通过利用WebJobs SDK使其连续)。

正如Thiago已经提到的,替代方法是在云服务上的Worker角色中安装Windows服务: https://blogs.msdn.microsoft.com/golive/2011/02/11/installing-a-windows-service-in-a-windows-azure-worker-role/

不是很直接,但也不是很可怕。

相关问题