Implementing Windows Service app in Azure - visual-studio-2010

I'm a very beginner in Windows Apps. I created a Windows Service app to send mail automatically at a specific time daily. Its taking some configuration values from app.config file. Also there is a web reference too in the service application. Then I installed the app using
InstallUtil /i %myapppath%\windowsservicevb.exe
It worked fine. But with less knowledge in this Windows service application I've no idea how to install that in Azure. Do I just need the exe file or I need to copy the app.config file also into the same directory in Azure?

You need to migrate your windows service on to a worker role in azure if you are going for azure PaaS. example here - http://blogs.msdn.com/b/mwasham/archive/2011/03/30/migrating-a-windows-service-to-windows-azure.aspx
Although if you are on an azure - IaaS VM then it is going to be the same as in the case of a windows machine locally.

Related

Should I use a windows service?

Hi I have a console app which I need to start up when Windows Server 2012 starts and without needing to login. I've done a bit of research and people advise a windows service is the correct approach, however the links are quite old and I wanted to confirm this is still the case, or indeed correct at all. Cheers.
Yes, Windows Service is still the most popular way to write and run servers and or a 'daemon' in Windows OS.
Depending on what your application is doing, you might have other options though, e.g. hosting an application in IIS (Microsoft's Web server application in Windows Server).
More recently, Microsoft has been working with Docker to also allow the use of containerized application deployments, which is available in new versions of Windows Server (Windows Server 2016).
Here are a few resources for more reading:
For .NET developers: Walkthrough: Creating a Windows Service Application in the Component Designer
Not just for .NET developers: Quick Start: Windows Containers on Windows Server

Windows Azure specific version?

Why is there a specific version of MongoDb for windows azure? The normal windows version seems to work just fine? What's the difference between those two?
This seems to be the case for a lot of applications, including memcached which someone have made a windows azure port of.
Why would I use a windows azure version of any application? What do I gain?
Why is there a specific version of MongoDb for windows azure? The normal windows version seems to work just fine? What's the difference between those two?
The normal MongoDB install requires an existing Windows environment.
The MongoDB Installer for Windows on Azure includes the provisioning of Azure VMs as well as installation of MongoDB. Provisioning options can also include selecting an Azure data centre location and creating multiple VMs for a replica set.
There is also a package to deploy MongoDB Worker Roles using Azure's Platform-as-a-Service instances.
Why would I use a windows azure version of any application? What do I gain?
If you use the normal Windows installer, you have to create the Azure instances yourself and then download & install MongoDB. If you are creating a replica set you will have to repeat this for each node and add the configuration manually.
The Azure installer simplifies the number of manual steps needed to get your deployment up and running.

Setup continous deploy from Visual Studio/TFS to a Windows Azure VM

Is it possible to automatically deploy to a Windows Azure VM after a successful build from Visual Studio/TFS?
You question is not totally clear if you are looking for a solution for Windows Azure Virtual Machines or Windows Azure Cloud Services.
Windows Azure Virtual Machines:
With Windows Azure Virtual Machine, you own your Virtual Machine and thats why you would need to configure any deployment mechanism you decide. The OS VHD deployed for Windows Azure could be the one you upload or the one you got for gallery, so there are no basic deployment services running unless someone configure them first. For example if you will choose Windows Server based Windows Azure Virtual Machines, then you can install Web Deployment Services in Azure VM, and then configure your VS/TFS to continious deploy it or you can setup FTP based services to deploy your app. This SO discussion talks more on this regard.
Windows Azure Cloud Service:
If you are looking a solution directly from VS then you can add post build scripts using Poweshell commands. This solution will not depend on TFS at all. There are a few solutions also described which are non powershell dependent as well.
Using Visual Studio and Team foundation server components you have ability to configure the combination of MsBuild and PowerShell scripts as described here and here (same as Herve).
If you are looking for a solution directly from Windows Azure TFS (Cloud Based), this article includes everything needed.
You can find some information about automatic deployment here: http://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/

Hosting Mutitenant Application on Windows Azure Management Portal

I have gone through the Lab AdvancedWebAndWorkerRoles which you have provided in the latest training kit WAPTK. I followed the steps in Exercise 1:registering sites,Applications and Virtual directories .It is running fine in windows azure emulator(locally),but i cannot find any steps to host in the windows azure management portal.
Can any one suggest(steps) how to host the same application in the windows azure management portal?
We know how to deploy applications in windows azure portal.As i had mentioned in my question about the Exercise 1:registering sites,Applications and Virtual directories in the training kit WAPTK ,we want to create the similar application and host in the azure.The steps to host the Exercise 1 application in management portal is not mentioned in the training kit.We tried to host the application in windows azure portal but it is not working as the ServiceDefinition.csdef include some different configurations.We wanted to know the steps to host that application in management portal.
Under the Introduction to Windows Azure lab, look at Exercise 3: Publishing a Windows Azure Application. This shows how to publish via the portal. The basic steps:
Build your Windows Azure service in Visual Studio, but tell it not to publish. Just generate the package file and configuration file.
Create a new hosted service. This gets a name like myapp.cloudapp.net. You'll need to find a unique DNS prefix.
Select the generated package file and configuration file, from the portal, which results in your service being launched. This takes a few minutes, and you can watch its status via the portal.
You may also publish directly from Visual Studio. See this MSDN article for instructions on setting up Visual Studio correctly (which basically imports your publishing settings from the portal). Visual Studio can perform all of the steps without having you to actually do anything in the portal (aside from exporting your publish settings).

How do you add a windows service to an existing application installer?

We've created a windows service to detect the insertion of a particular usb device.
That service is then supposed to launch an application we have written.
We initially made a setup project for our application and a separate one for the windows service.
Now, we are trying to get the service and the application installed in the same setup project.
We tried putting the output of our service into the setup project but without any luck.
We have the a projectinstaller class in the service, so why can't we simply add the project output of the Windows service (including the installer class) to our application's setup project?
There is MSDN article explains it, Create the installers for your service. Microsoft support also have an article, How to create a setup project for a Windows Service application in Visual C#
My primary language is Delphi. In Delphi, when a program is created as Service Application,
installing the program as a Windows Service can be done by running my_service_app_name.exe /INSTALL. I guess, the execution mechanism should be roughly same with service applications created by other compilers.
Thus, adding a windows service to an existing application installer can be done by just running the service application as mentioned, but you should refer to the documentation in case you are not using Delphi.

Resources