sept. 25

We have seen previously how to create and deploy a windows service (here and here using a separate installer DLL). What we have seen also is that we can control the start type of the service to specify whether it will be launched manually or automatically. This is very interesting, however this will be used internally by windows only at the next startup of the operating system.

It seems very logical that if we install a service and that we want it to start in an "automatic way", this service shall be running at the end of the installation process, and this without any manual action. We can do this in a very easy way via the installer (I will start again from the previous installer DLL we have created in this post).

Updating the installer

We will need to work at the end of the installation, ie on the "Commit" event. To do so :

  • Right-Click on the setup project and choose "View / Custom Actions"
  • Right-Click on the "Commit" event and choose "Add Custom Action"
  • Choose the "Primary Output from MyWindowsServiceInstallerActions" (from the Application Folder) and click OK

Now our installer DLL will also get called when the commit is occuring.

Starting the event

We can now update the installer class as follows :

using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using System.IO;
using System.ServiceProcess;
namespace MyWindowsServiceInstallerActions
   public partial class MyInstaller : Installer
      //Other implementation remained unchanged, and so ommited here
      protected override void OnCommitted(IDictionary savedState)
         ServiceController service = new ServiceController("MyPersonalService");

Some explanation about the code :

  • We could have decided to do the same treatment on the "Commit" event
  • The ServiceController class let's us manipulate a service (based on the service name, as set in the constructor of the service)
  • If for any reason, the "Start" method doesn't work (problem in the service, event log full, ...) an exception will get raised, and so the installation will fail and rollback.

A more secure implementation would be something like (you must of course include a reference to System.WindowsForms.dll if you want to use the MessageBox class) :

protected override void OnCommitted(IDictionary savedState)
   ServiceController service = new ServiceController("MyPersonalService");
   string errorMessage = string.Format("Could not start the service {0}. You should launch it manually"
   //We'll try starting the service only if not started yet
   if ( service.Status == ServiceControllerStatus.Stopped )
         //Let's wait (for max 10 seconds) that this service is running
         service.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 10));
      catch ( InvalidOperationException )
         //The Start method failed
      catch ( System.ServiceProcess.TimeoutException )
         //The Start method succeeded, but after 10 seconds, the service was still not running
Note that we use the fully qualified name for the TimeOutException not to have any ambiguity with the same exception in the System namespace.



Posted on mardi, 2 octobre 2012 19:02


Thanks very much for this clear code!
Now I'd like to know the service name automaticaly without using hardcoded text "MyPersonalService".

Can we do that in this step?

Thanks and regards.

my website

Posted on dimanche, 28 juillet 2013 02:20

The sad facts are most of the people who get into these refinancing options will miss their car  my website -  you can focus your time on applying with lenders that can get you approved.

Posted on samedi, 3 août 2013 09:20

Everything is very open with a very clear clarification of the issues. It was definitely informative. Your site is extremely helpful. Thank you for sharing!

my web site; salt Craving - -  -

not fake

Posted on lundi, 12 août 2013 01:35

Moreover, the loan amount retrieved could be used for any kind purpose according to the borrower's requirements  not fake -  another cause of low credit score car finance financing being so easy is the fact that the vehicle is the collateral.

pure garcinia cambogia extract

Posted on vendredi, 23 août 2013 13:22

Heya! I'm at work browsing your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the fantastic work!

My blog post  pure garcinia cambogia extract -

check over here

Posted on dimanche, 1 septembre 2013 05:33

First of all I want to say terrific blog! I had a quick question that I'd like to ask if you do not mind. I was interested to find out how you center yourself and clear your head before writing. I've had a hard time clearing my thoughts in getting my thoughts out. I do enjoy writing but it just seems like the first 10 to 15 minutes are wasted just trying to figure out how to begin. Any ideas or hints? Many thanks!

Here is my site ::  check over here -

Posted on mercredi, 4 septembre 2013 04:01

What are dormers Dormers are basically a part of a three-part solar roofing system, which makes maintenance a much easier task. However, there are many restrictions in place in the construction industry, these restrictions or safety requirements always need to be followed. Built-up roofing has been shown to reduce annual cooling energy roofing home depot on homes by 25 percent compared to dark roof surfaces.

Visit my web page Ideal Roofing 8000 Series ( - )


Posted on jeudi, 5 septembre 2013 19:59

Večera koristan kapija  nervozno  prezentirati  spavanje. Tko god sanjati svoju krv znacenje svet obično.Sanjati posao  brtvljenje od sanovnik tumacenje snova sanjati zmije. Weeder svjež vino  hrabro izostaviti  koje. Mene  sanovnik -  jajce odgodjeno daleko.Tumacenje snova o smrti  unaprijediti vanjski sanjarica svoje vjencanje.

Injustice ios hack

Posted on samedi, 7 septembre 2013 22:35

When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Many thanks!

Here is my site ...  Injustice ios hack -

where to buy garcinia cambogia

Posted on lundi, 9 septembre 2013 02:41

Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!

My web-site ...  where to buy garcinia cambogia -


Posted on lundi, 16 septembre 2013 05:42

Fill in a title for your ad, then enter the text in the "Description" field. Checking your appliances is usually the first step when attempting to locate an electrical short. Perth is one city that's taking advantage of this system in which a private firm will take care of a wide range of environment-related services within a plant.

Feel free to visit my site:  http://Electricianwaynenj.yolasite.Com/ -

garcinia cambogia benefits

Posted on samedi, 21 septembre 2013 11:53

This post is genuinely a fastidious one it assists new the web visitors, who are wishing for blogging.

Here is my site;  garcinia cambogia benefits -


Posted on jeudi, 26 septembre 2013 02:09

Basically, each one of us pain near ovaries experiences back pain at some instances in their life. The bad side of these technological advances is that we have come to associate with a bulging disk relief can be difficult to manage.

Review my blog ... Chiropractic Quackery ( Marla - )

carpet cleaning long branch nj

Posted on mardi, 1 octobre 2013 16:06

Sometimes one can reduce the drying time by switching on the fans or opening doors and windows to allow the flow of dry air around the freshly cleaned carpet. Hot water cleaning is very effective as and when compared to detergent cleaning because in this process the residue of detergent may remain in the carpet after the cleaning process. You are also going to need to think about things like how the carpet looks and feels.

Here is my homepage ...  carpet cleaning long branch nj -


Posted on mercredi, 2 octobre 2013 09:13

It is also great if they have been in business for a while because you know that to stay in business they need to be doing a good job. We supply all of the paint and materials needed to complete your project, and by using the latest in colour matching technology, we can help you pick the best colour for every room in your home. Stetson paints different surfaces like wood, stucco and vinyl.

Here is my web site ( Mae - )


Posted on samedi, 5 octobre 2013 03:47

As an IICRC Houston carpet cleaning specialist, it's my job to educated the general public about the dangers of mold living in their carpets. When using the flea comb, have a cup of water nearby to dip the comb into whenever there are fleas or flea eggs in the teeth of the comb. First, attempt to clean your rug using these natural methods to avoid bringing toxic chemicals into your home.

Here is my homepage: carpet cleaning trenton nj ( Sang - )

Posted on dimanche, 6 octobre 2013 08:07

The rate per square foot. The only difference being that office appearance matters a lot, when it comes to carpeting for your house, office and business establishment clean, sound and beautiful. Carpet tiles offer a new way to change the look of the carpets. After all it determines whether you will get. The only way for you. That being said, you should never give up on the long run.

my weblog - carpet cleaning oceanside ( - )

carpet cleaning columbia mo

Posted on dimanche, 6 octobre 2013 21:43

The most important aspects from the home will be the synthetic carpet of choice as it's a low maintenance type of carpet in some other portions of the house carpeting for you. However, pet carpet cleaning and upholstery stains, shoe polish, and food stock from your carpet. There are some great examples of what you will help do for them. If you buy your carpet. Sunlight kills most forms of mold, and of course, but is home to dirt as well as the debris from the floor.

Here is my website -  carpet cleaning columbia mo -

Carpet Wayne NJ

Posted on jeudi, 10 octobre 2013 05:10

Take time to write a few and try them out on some friends or associates. What in the world, does one have to do with the other. Carpet Cleaning Romford also recommends using a lint roller to deal with small thick patches of pet hair.

Also visit my blog post -  Carpet Wayne NJ -

Rug Cleaning Passaic NJ

Posted on jeudi, 10 octobre 2013 05:21

The vacuum cleaner manufacturing industry may have been concerned that adopting a more reliable test protocol would "upset the apple cart" or transfer the balance of power from the larger manufacturers to the smaller, more pragmatic manufacturers. Your carpet cleaning service provider should be experienced enough to get the job done in an effective manner. Steam cleaning is used for cleaning the deeper layers of the carpet that the nozzle of the vacuum cleaner cannot reach.

Also visit my site:  Rug Cleaning Passaic NJ -

Carpet Cleaning Hamilton New Jersey

Posted on jeudi, 10 octobre 2013 06:24

Even though dry cleaning carpet and using dry foams to clean carpet are quite a bit more convenient and a whole lot less messy, a good old fashioned steam cleaning and shampoo is usually best for heavily soiled carpets with a lot of wear and tear. The franchise will be costly, but with the cost outlay will come a formula for success. If you are looking for carpet cleaners Jacksonville, you won't find a better  carpet cleaners Jacksonville company than the one called AC Carpet and Tile Cleaning.

My web blog ...  Carpet Cleaning Hamilton New Jersey -

Oriental Rug Cleaning Irvington NJ

Posted on jeudi, 10 octobre 2013 12:52

Take time to write a few and try them out on some friends or associates. The only cleaning component used is heat that is produced by the steam. This loosens up the dirt and tends to make it easy to be vacuumed up.

Also visit my website:  Oriental Rug Cleaning Irvington NJ -

Carpet Paterson NJ

Posted on jeudi, 10 octobre 2013 18:57

To begin with, business carpet cleaning devices have bigger temperature and pressure amounts for more thorough cleansing. The main goal is to treat the window treatments, carpets and rugs like various companies would treat the own. If you want make sure that the carpet is completely germ-free, apply a deodorizing or sanitizing solution.

Take a look at my website  Carpet Paterson NJ -

Posted on jeudi, 10 octobre 2013 23:05

This is not always possible for you to buy insurance insurance 350z since Florida passed the condo insurance for fire, smoke and accidental water leaks. How to Find a Low Rate Georgia Home Owner Insurance Quote Health Insurance Quotes Georgia Car insurance 350z Insurance Quotes In Singapore? To hunt down the very best option if they cannot be random people off the street.

Feel free to surf to my website instant car insurance ( - )

carpet cleaning trenton nj

Posted on samedi, 12 octobre 2013 04:21

Everything we use is non-toxic, non flammable, all materials are totally biodegradable, has no preservatives, acknowledged by the EPA's program. If you also set the correct monthly rent, you should be on your way to years of good monthly rental income. Before you decide to employ the services of a professional cleaner or cheap carpet cleaning services, there are specific factors that you have to evaluate.

My page;  carpet cleaning trenton nj -

carpet cleaning manalapan nj

Posted on lundi, 14 octobre 2013 00:13

Steam Carpet Cleaning Advantages and Comparison with Other Methods. Pollen, dander, ragweed, and others are considered to be allergens. If it was just your brother coming, he would never notice what condition the carpet was in, but your sister-in-law and mother-in-law will arrive armed with white gloves, critical eyes and sharp tongues.

My site  carpet cleaning manalapan nj -


Posted on mardi, 29 octobre 2013 16:41

Your real estate property insurance waiver form and to your car. These are what they are claiming for $300 and your deductible is $300 then only insurance waiver form you should pay for it all.

My site :: Wide Leg Pants ( Http://Serranoedcp.Blog.Com - )

Flashing Indian Sex

Posted on mercredi, 30 octobre 2013 19:23

Excellent post. I was checking continuously this blog and I am impressed! Extremely helpful info specially the last part Smile I care for such information a lot. I was seeking this certain information for a very long time. Thank you and good luck.

Feel free to visit my site:  Flashing Indian Sex -

check over here

Posted on jeudi, 31 octobre 2013 03:20

This info is worth everyone's attention. Where can I find out more?

My web-site ::  check over here -


Posted on dimanche, 3 novembre 2013 02:51

Another better way to find the right roofing contractors in Atlanta to get a leaking roof would never put a pause in the market, how do you know why? These are considered durable as well as durability. Roof repair is an essential part in many different roofing questions colors. Using roofing questions this type of application is in the morning or later afternoon during periods of non turbulent winds.

My web page - roof vent cap ( Marsha - )

Duo Residences

Posted on lundi, 4 novembre 2013 22:49

Having read this I thought it was extremely enlightening. I appreciate you finding the time and energy to put this informative article together. I once again find myself personally spending way too much time both reading and posting comments. But so what, it was still worth it!

Check out my page:  Duo Residences -

curved Desk

Posted on samedi, 9 novembre 2013 05:06

This is the best choice. Based on research studies and statistics, men are most likely to buy from Maryland Nissan, and find out. Insurance fraud is car insurance uk also a great choice if you're the adventurous type. As said, no one knows what will happen to the financial position as it was earlier. At some point in our lives.

Also visit my website  curved Desk -


Posted on dimanche, 10 novembre 2013 14:34

Auto insurance premiums vary widely from car insurance quotes nj one insurer to another? If you've got car insurance before the policy expires. But it doesn't mean that you have the insurance policy coverage. At the same time it can save you another 10 to 20 percent.

Also visit my homepage - copper pots ( Fidel - )

Flood restoration emergency

Posted on lundi, 11 novembre 2013 23:31

It's not mold just the odor that this oil produces, tends to be found in the kitchen will be greatly reduced simply by having one of these items can and commonly do overflow.

Also visit my page -  Flood restoration emergency -


Posted on mercredi, 13 novembre 2013 21:02

The best way to handle pets is to have the ability to get carpet cleaning using borax out of the air inside your home. Successful cleansing by these machines is in auto detailing. Carpetings will have an effect on the glimpse of the carpet or upholstery fabrics also, although not as frequently. To make all these dry carpet cleaning method do not wash your carpet in your own ownership.

Feel free to visit my weblog: peerless carpet cleaning ( Marylin - )

pirater un compte facebook gratuitement

Posted on dimanche, 17 novembre 2013 16:12

Différent,joyeuse  famille d'ailleurs échapper à partir de nerf pirater un compte facebook gratuit*.  gémissement à l'intérieur 66�me activit�s pirater un compte facebook 01net.

Also visit my page ::  pirater un compte facebook gratuitement -

Cumshots Blowjobs

Posted on mardi, 26 novembre 2013 20:52

Wow, marvelous blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is wonderful, let alone the content!

Also visit my homepage ::  Cumshots Blowjobs -

Century bob xl punching Bag

Posted on jeudi, 28 novembre 2013 15:14

Appreciation to my father who told me about this website, this weblog is genuinely awesome.

Here is my web site ...  Century bob xl punching Bag -

nyc condos for sale

Posted on samedi, 7 décembre 2013 09:16

We car insurance grace period might estimate another $10, 000. Taking car insurance grace period up discount offers can make expensive insurance policies affordable. So if vehicle insurance expense is an problem for you, and the Commonwealth of Puerto Rico are the only ones who canhave a SDI.

Also visit my web-site;  nyc condos for sale -


Posted on mardi, 10 décembre 2013 07:24

Out mold 64 job is to get protective gear which will keep you safe from any further outbreaks of mold, which is controlled by diet. For example, in the country have used examples such as the bathroom or laundry area, you want them that have lids. Employees will be more productive in a healthy, clean environment that has mold on it? Place each slice of bread on it's own plate for the children to be able to get rid of the mold test kit.

Also visit my weblog; webpage ( Morgan - )


Posted on mardi, 10 décembre 2013 12:34

If you are plagued by mold on your hands, there mold hair loss are guides and manuals available on the internet. With or without condensation, mold can grow in many places, especially in the high-end products. But it might also be affected by black since the moment such persons come into contact with the mold he/she can get skin rashes. Though the impairment is severe, the toxic fungi cover the walls and the ceiling with this kind of damage.

Also visit my site :: 187)” [ Evonne - ]

mortgage rate Forecast

Posted on jeudi, 12 décembre 2013 05:10

This is insurance 9 points also instrumental in ensuring that the roof was destined to fall no matter what the odds are, they are a good alternative to dental implants insurance would be less. Not only are they provided with competitive quotes, but remember that the reward is not a lot that will beat probably the most inexpensive vehicle insurance policy strategy accessible, nevertheless you'll find some car insurance. Comprehensive car insurance is somehow costly depending on your specific policy.

Look at my web-site ::  mortgage rate Forecast -

games jerseys

Posted on vendredi, 20 décembre 2013 23:06

Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your website? My website is in the very same niche as yours and my users would definitely benefit from a lot of the information you present here. Please let me know if this ok with you. Regards!

Here is my blog  games jerseys -

ugg レザー ブーツ

Posted on samedi, 21 décembre 2013 01:59

ugg レザー ブーツ -  We stumbled over here  different website and thought I might as well check things out. I like what I see so now i am following you. Look forward to exploring your web page yet again.  ugg レザー ブーツ -

not fake

Posted on lundi, 23 décembre 2013 10:15

If a paycheck remains to be weekly or even more away, the cash advance lenders will probably be a best option provided that that upcoming income will handle the fee to cover rid of it  not fake -  now that you know where to identify a fair online payday check advance lender by way of a multiple lender site then it is essential to ascertain if you ought to even remove a advance loan loan.


Posted on lundi, 23 décembre 2013 23:18

Hi! I'm at work surfing around your blog from my new iphone 4! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the superb work!

Stop by my site; Vintage Webcams ( Laurie - )

fix ipod touch

Posted on dimanche, 9 février 2014 18:16

It's very effortless to find out any matter on net as compared to textbooks, as I found this piece of writing at this website.

Look into my webpage ...  fix ipod touch -

Posted on samedi, 5 avril 2014 19:07

I think that everything posted made a ton of sense. But, what about this? what if you typed a catchier post title? I mean, I don't want to tell you how to run your blog, however what if you added a headline to maybe grab people's attention? I mean Pierre-Emmanuel Dautreppe | How to start a Windows Service is a little vanilla. You might peek at Yahoo's home page and watch how they create post headlines to grab viewers to open the links. You might add a video or a pic or two to get readers excited about everything've written. In my opinion, it might make your posts a little livelier.

My web blog ... Paddy o'Brian ( - )

how to take garcinia cambogia extract

Posted on dimanche, 6 avril 2014 10:12

Regards, Plenty of advice!

Also visit my web page;  how to take garcinia cambogia extract -

Posted on mercredi, 15 avril 2015 09:12

Pingback from

House Cleaning – How To Determine On Domestic Cleaners | elliestoneman93

Ajouter un commentaire

  • Commentaire
  • Aperçu immédiat