Reputation: 35
I have a NserviceBus Handler that gets installed as a service on a VM usually. We are trying to get this to work on Azure as a PAAS. So the idea is to publish the solution as an azure webjob. When I do publish it as a web job I am getting a pending start status on it. The logs indicate the following.
[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
What am I missing? How do I get NServiceBus Handlers to work as WebJobs on Azure?
Upvotes: 2
Views: 1196
Reputation: 26414
I would just rewrite the service so it's no longer a Windows Service but a Console Application. You can then tell the WebJob host to run it on a schedule (or make it continuous by leveraging the WebJobs SDK if that makes more sense for your scenario).
The alternative approach, as already mentioned by Thiago, is to install the Windows Service inside a Worker role on Cloud Services: https://blogs.msdn.microsoft.com/golive/2011/02/11/installing-a-windows-service-in-a-windows-azure-worker-role/
Not exactly straight forward to do but not horrible either.
Upvotes: 3
Reputation: 18387
It won't work with Azure Web Jobs, you can try to run it as Cloud Services with elevated privileges, but I'm not sure if it will give you privileges to install it as a windows service. So I'm afraid there's no other way rather than use a Virtual Machine for that. If you want a PaaS alternative, you can try to rewrite this piece of your app using Azure Service Bus.
Upvotes: 0