6
votes

I am trying to Install a windows service I made with the following command :

C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug>InstallU til.exe filechecker.exe

but I am getting the following message:

Running a transacted installation.

Beginning the Install phase of the installation. See the contents of the log file for the C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.exe assembly's progress. The file is located at C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.InstallLog.

An exception occurred during the Install phase. System.ArgumentException: Must specify value for source.

The Rollback phase of the installation is beginning. See the contents of the log file for the C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.exe assembly's progress. The file is located at C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.InstallLog.

The Rollback phase completed successfully.

The transacted install has completed.

Running a transacted installation.

Beginning the Install phase of the installation. See the contents of the log file for the C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.exe assembly's progress. The file is located at C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.InstallLog.

An exception occurred during the Install phase. System.ArgumentException: Must specify value for source.

The Rollback phase of the installation is beginning. See the contents of the log file for the C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.exe assembly's progress. The file is located at C:\$(MyFiles)\Projects\Win Service\c#\filechecker\filechecker\bin\Debug\filechecker.InstallLog.

The Rollback phase completed successfully.

The transacted install has completed.

How can I solve this issue?

1
this is the log file actually - themhz
I have had the problems many times in the past and have found that the reason is most of the time to do with errors/exceptions etc in the code. By far the easiest way to solve this problem is to create another project with the exact same code that you have in your Windows service and make this project a console application or something like that. Then run this code and you'll immediately see where the error is. Trust me it will save you hours of pain. - Sachin Kainth
I see..., well my code is actually a console application and runs well. I decided to make it a service because I have trouble with the schedule task manager. I will post the code in a while, its very simple. - themhz
It's a good idea to have all the logic of your service in a seperate assembly and make the service project only a wrapper. This way you can have a separate project which you can use to start your service as a regular process. This makes debugging a lot easier. - Marek Dzikiewicz
Thanx, the problem was that I did not fill the property service name witch it has to be the same name with the project as it seems. Thank you - themhz

1 Answers

12
votes

A ServiceInstaller always1 creates an event log source, and sets the Source name to the ServiceName. The error suggests to me that you're not setting the ServiceName on your ServiceInstaller instance (although I'd have hoped for a better error).


1Unless you manually iterate its installers collection and remove it, after it's instantiated. You'd also have to make sure you turn off all of the automatic logging and/or manually add your own EventLogInstaller using the same source name - this can be useful if you wish all logging from the service (including automatic logging) to go to somewhere other than the Application event log.