I\'ve written a Windows Service in C# that does a whole bunch of background admin tasks on the database. Now my customer wants to migrate the whole shebang to Azure. I kno
For smaller jobs, you can use Azure's WebJob facility, which runs within a web app (useful if you're doing background tasks on the same data that a front-end site is managing).
There's a nice breakdown here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/
WebJobs are pretty easy to get running, but don't have the power of Worker Roles. See the following for a comparison: Worker Role vs Web Job
Here are the steps to install a windows service on Windows Azure running VM with 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.
You can run whatever you want, including a Windows Service.
I think you'd be happier converting to a WorkerRole, though, which should be very straightforward.
Yes you can do that - for a simple walkthrough see http://blogs.msdn.com/b/mwasham/archive/2011/03/30/migrating-a-windows-service-to-windows-azure.aspx
Other links with relevant information:
Yes, no problem, here is another nice and easy to follow example Get Started with Azure Cloud Services. It (also) clearly shows how to implement the WorkerRole. You can use the WebRole to manage your service.
I would use web jobs for this, it's scheduling functionality and easy deployment/config makes this a trivial task. Zip up your .exe and upload it, then set a schedule and you're done.