I've to create a service in Visual Studio for one customer.
The customer IT service indicate me that they don't want any installer, only one exe that can be installed with instsrv.exe.
So I created a Service project on VS2010, compilated it(in 64 bits, it's an application that has to be ran in 64bits).
First problem: I didn't found any instsrv.exe, so I used InstallUtil.exe, the 64 bits version :
C:\Windows\Microsoft.Net\Framework64\v4.0.xxxx\InstallUtil.exe "PathToMyGeneratedExe"
It says me that "The commit phase completed successfully." and "The transacted install has completed.".
So I assume that the install completed successfully.
But if I go in the service console, I can't find the created service.
So what am I missing?
InstallUtil is intended for usage with a service installer (which is really easy to make, but a bit buried) I imagine your client wasnt after a gui installer but I think it may be worth your while putting in the base serviceinstaller.
Normally InstallUtil will also prompt for a user to run the service under as well. if you havent got this you probably arent installed
Take a read of http://arcanecode.com/2007/05/23/windows-services-in-c-adding-the-installer-part-3/ for details of how to do this
(TLDR right click on your service design surface and add installer)
Related
There is one windows service which is installed on one of our servers and working fine.
I tried to replicate the same on the other server, so I took the exe setup from one server to another and tried to install the windows service using installUtil.exe
It is giving me
The Commit phase was completed successfully. The transacted install has been completed.
but the service cannot be found in the services list and it is also giving me this message at the time of installation.
No public installers with the RunInstallerAttribute.Yes, the attribute could be found in the xyz.exe assembly.
Remove InstallState file because there are no installers.
and I am not sure why this is happening? I tried googling but most of them have given the solution to add installer to the project.
But if the installer is not added how the service is running on the first server
is there another way to install the service?
Could it be related to the Windows OS version?
I've been working to update a C# service with a new Visual Studio 10 Installer. The old installer is a batch based installer that is a pain to use with Windows 7 and higher, but still works correctly (for both install and uninstall).
I created the new Visual Studio Installation project using this as my guide.
The solution includes a small application used to show the service status in the tray. It's output is added to the installation project and included in all of the custom actions alongside the service.
The service installs and runs correctly with my new installer, but uninstall causes a happy little blue screen of death. The dump shows the crash is coming from ntoskrnl.exe+22fa3 (Critical_Object_Termination).
What methods can be used to track down a crash that occurs during uninstall?
If the service can be stopped, then there is something really aweful in your custom action. Custom actions shouldn't be needed in the first place so try this tutorial instead.
There is a weird issue I am facing. I created my first windows service looking through various blogs and tutorials.
Then created setup for that adding installer etc. It works fine while installing , un-installing via Visual Studio but it fails when i deploy it .
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\bhuvint\Documents\Visual Studio 2010\Projects\CPNS Library\ServicePackage\CommonPushNotificationWindowsService.application resulted in exception. Following failure messages were detected:
+ You cannot start application CommonPushNotificationWindowsService from this location because it is already installed from a different location.
+ You cannot start application CommonPushNotificationWindowsService from location file:///C:/Users/bhuvint/Documents/Visual%20Studio%202010/Projects/CPNS%20Library/ServicePackage/CommonPushNotificationWindowsService.application it is already installed from location file:///C:/inetpub/wwwroot/ServicePackage/CommonPushNotificationWindowsService.application. You can start it from location file:///C:/inetpub/wwwroot/ServicePackage/CommonPushNotificationWindowsService.application or you can uninstall it and reinstall it from location file:///C:/Users/bhuvint/Documents/Visual%20Studio%202010/Projects/CPNS%20Library/ServicePackage/CommonPushNotificationWindowsService.application.
I have already un-installed the service and trying to install it from the deployed service in the same pc to test. But it fails with above error.
I feel i have deployed the windows service the wrong way. Could you guys please suggest how to deploy a windows service ?? (I have looked through net. All suggest building it and installing it from visual studios. But how to publish it is the thing which i need.)
Please help asap.
Possibly you built the setup project before uninstalling the preovious service. In that case you can't use the new setup to uninstall the service, since the setup won't be the same and can't be able to access the service installed.
You should try to go to a previous version of your project and uninstall the service and for the future unistall the service each time you're building your setup project.
This happened to me several times.
Run visual studio in debug mode, and in your properties of your service project goto tab build events in Post-Build event command line and add a -d so you can run your service without installing it, it will run as an console app
The LocalService account acts as a non-privileged user on the local computer, and presents anonymous credentials to any remote server. Use the other accounts with caution, as they run with higher privileges and increase your risk of attacks from malicious code.
If your service application will not install correctly, check to make sure that the ServiceName property for the service class is set to the same value as is shown in the installer for that service. The value must be the same in both instances in order for your service to install correctly.
NoteNote
You can also look at the installation logs to get feedback on the installation process.
You should also check to determine whether you have another service with the same name already installed. Service names must be unique for installation to succeed.
STUPIDITY PERSONIFIED
As i told i was deploying my service. So this published code had a "setup.exe" file to it. Now I had already created a setup project for the windows service , which i was using for the installing , uninstalling . And i din't know (These words needs courage !!) that msi file created is required to install the windows service. So as i got through the folder structure of the setup project. I came across the .msi file . And hence the problem got solved. The Main problem was :
Me not knowing to use setup projects
And I confused setup.exe with the published windows service with the setup of windows service.
I am really sorry for stealing bandwidth off your precious time. Thanks to all for the valuable inputs.
I would like to know if there is an easier way to install or uninstall windows services onto dev or test environments without creating setup packages? I am having issues with uninstalling visual studio packages sometimes (even after stopping the service and closing the service management console before uninstall forcing me to reboot the machine). this issue can be overcome by using tools like InstallShield or WIX to create setup packages, but during development it will be easier if I can install the service (along with all the dependent files) in dev or test environment without creating a setup package.
Use installutil, which is part of the .net framework. Now you still need to copy the bin directory to the desired machine and register any COM objects if you are using any.
If remember right,( no access to my dev machine at the moment). Stop the service - and replace the exes and dlls) restart the service. You can script this. You will need to do an initial install, or use the installutil.exe
I found this much easier that installing and uninstalling, all the time.
I find the SC.EXE command to be easy to use during development. Slap it into a NAnt/BuildBuild/Perl/BAT file and instant light weight automation.
I know this is an old question, but I feel this information is highly relevant to anyone struggling with this issue:
The problem comes from a change in the Installer included in Visual Studio. I think the change occurred between VS2005 and VS2008. Regardless, after the change, to have an update installer work properly without uninstalling the prior product, it was recommended that Services be installed via Custom Actions in the Install, Commit, and Rollback phase, but not the Uninstall phase. I believe this is because the change caused the Uninstall action to occur after the new version was installed, uninstalling your service upon update. A Condition of "Not PREVIOUSVERSIONSINSTALLED" is placed on the 3 Custom Actions and Check For Previous Versions must be TRUE. This results in essentially the same result as copying the files over the old ones (but also retains any other install activity such as registering objects, etc.)
This all works great for updates; a new version will install over an existing version, the service remains registered, all is well. However, if you uninstall, your service is left registered, and a fresh install will attempt to register it again, resulting in the 1001 error. I use SC.EXE to delete the service manually when I uninstall to avoid this. You can have a clean uninstall, but it will break update installs, your choice.
I am currently building a Windows Service with C# and I just can't figure out how to debug it.
I am building it and then registering with installutil:
> installutil MusicRepo_FileMonitor.exe
The Commit phase completed successfully.
The transacted install has completed.
And as you can see above, it is supposedly being registered successfully, but I can't find it in services.smc. I have also tried starting the service with net start [ServiceName] but it's telling me The service name is invalid. so I guess it's not finding it.
For the record, I'm on Vista and I'm developing the ws with .Net 3.5
[Update]
Solution
Try Task Manager and see if you see MusicRepo_FileMonitor.exe. If not, then the service is definitely not running.
Alternatively, in Visual Studio, Debug > Attach to Process, check show processes from all users, and see if its there.
Upon further research, I realized that I had no Installer attached to the service, so the problem was now fixed by adding an Installer.
Here is the tutorial I used to add a Service Installer and so on.