Viscus Lokendra
Viscus Lokendra

Reputation: 21

Install service in windows azure

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

Answers (4)

luksmir
luksmir

Reputation: 3154

Here are the steps to install a windows service on VM running Windows Server 2012 R2:

  • start your VM in Windows Azure Console and connect to it with Remote Desktop Connector
  • 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

  • copy all the necessary installation files to the mapped storage (copy&paste)
  • copy nssm to a local drive (not z: as it uses MAFS file system and that cannot be accessed with low-level windows API commands)
  • Create a .bat file with the following entries

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.

  • run the script. The service should be visible in your services list.

Enjoy!

PS : I used NSSM to simplify the service deployment.

Upvotes: 0

user1355361
user1355361

Reputation:

Couple of things to add along with the other answers:

  1. You can install Services with Web or Worker Role through the Startup Task

  2. Alternatively you can also run a process with elevated privilege through the Task Scheduler

Upvotes: 1

Mike Erickson
Mike Erickson

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

user728584
user728584

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

Related Questions