Getting a Service to Run Inside of an Azure Worker Role

前端 未结 1 1384
耶瑟儿~
耶瑟儿~ 2021-02-06 01:15

I have a windows service that I need to migrate to onto Azure as a Worker Role. Everything builds fine in my Azure solution. However, when I upload everything only the web rol

1条回答
  •  粉色の甜心
    2021-02-06 02:08

    I think the root of your problem is that you basically can't install a service programmatically in Azure roles. You need to use a .cmd startup script and the InstallUtil to properly install the service then you can start it from the script or from your code (think from the script is often preferred for order-of-execution reasons).

    Here's a blog post on how to do it: http://blogs.msdn.com/b/golive/archive/2011/02/11/installing-a-windows-service-in-a-worker-role.aspx

    Here's another blog post that takes a little different approach (creating a .Net app that executes the installation, but again as part of the startup script): http://www.bondigeek.com/blog/2011/03/25/runninginstalling-a-windows-service-in-an-azure-web-role/

    Hope that helps

    0 讨论(0)
提交回复
热议问题