Reputation: 21
I would like to know that is there any way to install the windows service on Azure environment? Or is there any alternate way of doing the same?
Upvotes: 2
Views: 1370
Reputation: 3154
Here are the steps to install a windows service on VM running Windows Server 2012 R2:
map your storage as a new drive in your VM:
net use z: \mystorage.file.core.windows.net\endoint /u:myusername verylongkeythatendswith==
Storage key can be found in your Azure Management Console -> Storages -> Manage Access Keys
set username=xxx set password=yyy call d:\nssm install "My service" "%programfiles%\PathToService\myservice.exe" "-p 8677" d:\nssm set "My service" ObjectName "%username%" "%password%" sc failure "My service" actions= restart/60000/restart/60000/restart/60000 reset= 240 d:\nssm start "My service"
Username and password should be the ones you used to create the VM.
Enjoy!
PS : I used NSSM to simplify the service deployment.
Upvotes: 0
Reputation:
Couple of things to add along with the other answers:
You can install Services with Web or Worker Role through the Startup Task
Alternatively you can also run a process with elevated privilege through the Task Scheduler
Upvotes: 1
Reputation: 176
Another potential option is to use StartUp tasks to install a windows service in either a Web or a Worker Role.
Here is an MSDN article - although it seems a little short on the details.
How to Define Startup Tasks for a Role
Basically you will need to be sure that the installer is copied during the deployment and create a cmd file to execute the installer. Then add a Startup task element to the service definition XML file.
Upvotes: 1
Reputation: 2135
If I understand the question correctly what you need in Azure is a Worker Role, similar question on Stackoverflow: What's the concept of *worker role* in Windows Azure cloud?
Check out the this blog post 'Migrating Windows Service to Azure Worker Role' http://blogs.msdn.com/b/joseph_fultz/archive/2010/04/02/migrating-windows-service-to-azure-worker-role-image-conversion-example-using-storage.aspx
Also look at the Windows Azure Training Kit for code & usage sample for Worker Roles in Azure http://www.microsoft.com/download/en/details.aspx?id=8396
HTH
Upvotes: 2