running 2 windows services using different versions of the same application - windows-services

I have a server application that I install as a Windows service. I want to run two different versions of the same thing on the same server, they differ by the build I am on and the configuration. One being a beta version and the other being the live version. I can install two separate copies of the application on the server just fine but I can only start up on of them as a service at a time. Each service starts up fine if it is the only one. Any thoughts?
I am testing this on Windows 7 and on Server 2008.

The service name you register has to be unique. I add an instance ID to my service name when doing this type of thing.

Yep, as Brad says the name has to be unique (+1). And be careful what you pick, because it has to be unique in all space and time... We have had a service running on our windows servers for many years called "monitor" (it monitored processes). Imagine how overjoyed we were when Microsoft decided to add a service to Windows called... "monitor". Imagine our mirth as our installs started silently failing. Oh, how we laughed.
Pick your name carefully :-)

Related

Datastax Enterprise - Amazon M3.Xlarge Machines

Does anyone know how to use Datastax enterprise (using opscenter) in a cluster using amazon ec2 M3.Xlarge machines?
When I have tried to use these type of instances (that use ssd) I got the following error:
Launching instances failed.Invalid node size specified
If I use M1.Xlarge it works fine.
This is a problem with Opscenter itself. This should be fixed in the next major release of Opscenter. The OPSC-3233 internal ticket tracks this fix, and may be used to refer to this problem in support emails and release notes.

Is there a way to update a cloud app instead of redeployed?

I was starting Windows Azure using WebSites, now I'm facing with the situation where I need Crystal Reports in my site, so I'm looking for a way to install the Redistribute Files to use it in my web page to generate reports.
I follow this page:
http://dotnetspeak.com/2012/07/running-crystal-reports-on-windows-azure
So instead of having a simple website, I'm gonna use a cloud app. Unfortunately, I'm updating frequently my website (role in Windows Azure project).
Do I need to redeploy all the time my cloud app each time I update my MVC project? Because it takes so long (like an hour, because I included a msi installer)
Thank you
Unless you build some custom extensibility into your application with some very robust dependency injection, yes, you have to redeploy.
EDIT: After re-reading your question again, I realised that you're using Windows Azure Websites.
The correct way to accomplish this is to use a webrole rather than the Websites
What you need to do is to store the installer as a blob in Cloud Storage.
Then part of a Azure Startup Task you can download from the blob and execute the installer.
If possible, you can also use the WebPICmdline (i.e the Web Platform Installer Commandline) to download and install for you from the Startup Task.
Steve Marx has done a few posts on using Azure Startup tasks. Here is one of them http://blog.smarx.com/posts/windows-azure-startup-tasks-tips-tricks-and-gotchas
Adding a bit to #Robert's answer: If the actual execution of the MSI is taking an hour, then this is not a very good use case for web/worker roles. Anything that takes more than a few minutes doesn't really fit well with the stateless scalable model. If that's the case, you should consider running a Virtual Machine for running Crystal Reports. Then you can use your web role for everything else.
If, on the other hand, the one-hour time is mostly consumed by the uploading of the MSI, then I'm completely in alignment with Robert: Store the MSI in a blob, and then download it to your role instances upon startup.
I would suggest to split your single Cloud project into two - one for Crystal Reports only. This way you can deploy it separately from MVC site. You could also build extra smarts into start up task, maybe checking if Crystal is already installed. However, I think splitting them up should be good enough for you
Normally the update process does not lead to an complete re-image of your webrole, only the approot gets destroyed! Here you can find a very detailed information about what is happening on update and deployment: http://msdn.microsoft.com/en-us/library/windowsazure/hh472157.aspx
What does that mean to your problem? Code deployment is an "in-place update" process. If you install Crystal Reports in Drive C: or D: it wont get destroyed on each deployment.
In your Start-Up Task you have to check, whether the software is already installed, or not. In case it is not installed, just install it, as mentioned above on Drive C: or D:
Edit: I got the Point: Does your update Process takes so long, because of the file-size of your MSI? If so, i also suggest to upload the MSI into Blob-Storage.

Service installed on Windows 7 machine is not reading from its config file

I have a .Net 3.5 web service that installs perfectly on my old XP box. I recently got a beautiful new Windows 7 box and everything has been working wonderfully. Yesterday I remembered that I need to instal this service on my new box and attempted to perform the install.
After the install I did a quick test and it seemed to be working correctly. Later in the day, I went into the config file and made a small change. After restarting the service I was dismayed to discover that the change was NOT being picked up by the service and it continued to use the old values.
Can someone explain how this is possible? I am totally befuddled here.
You've most likely been a "victim" of Windows Backward Compatibility (aka UAC Data Redirection).
When a program running as non-admin tries to write to config files located in Program Files, Windows redirects the write to another (user local) directory. That means, a user can seemingly write the file, but another user will see the original, Program Files, version.

How do you deploy two or more applications that use Firebird Embedded databases on the same machine?

Suppose I have three separate applications called MyPasswordManager, MyToolManager and MyMovieManager. Each of these applications uses a Firebird Embedded database.
If a customer buys all three of my aplications and installs them on his/her computer. And my customer has all three applications running at the same time, what happens?
Will the Firebird dll's have conflicts? What do you do in this situation?
If you put the Firebird dll's in the application folder (where the .exe is) there won't be a problem since this is the first place where your application will look for them.
You have to make sure that the applications each install to their own folder, if you want to use different versions of the dll's.
Cape, you really ought to read the "readme_embedded.txt" file in the doc directory - it has all the answers youre looking for. Some relevant quotes (for the FB 2.5 version):
2.2. Database access
The database file can be accessed by multiple client
programs. The database consistency in this case is
guaranteed internally (by the shared lock table).
2.4. Compatibility
You may run any number of applications with the embedded
server without any conflicts. Having IB/FB server running
is not a problem either.
have you tested it in your dev machine? I think just putting the apps and the dlls in different folders each one could work. Maybe renaming the dlls with different names can work too

Process for updating a windows service? Automated or is it manual?

If I have a windows service on a server, what is 'best practise' for updating the service? (say there was a bug in it, or I need to ad more features to it).
Is there a way I could shutdown the service, patch it and get it up and running in a more automated way?
(any links with code would be great)
Well, you could always up the version on the installer (if you used one) and run that, from my experience it overlays old versions with the newer one.
Or you could simply shut down the service, copy in the new .exe (and dependencies if any) and start it back up. This could all be done with scripting and the NET start/stop functions I would imagine.
I'm sure there is a better way to do it than this though...
Depends how your service is written - monolith EXE - you'll need to stop and restart it using a process of choice e.g. Installer, Script + Service Control, batch and NET STOP/START etc.
If you structure it a little differently e.g. bootstrap EXE loading your service implementation as modules that can be unloaded/reloaded then you can have a different conversation. This is of course a quite a bit more complicated.
I've had some success in C# with a hosting solution like this, similar conversation here:
I want my C# Windows Service to automatically update itself
InstallShield supports Windows Services. Leveraging installers will make your task much simpler.

Resources