In VS 2013, I have a service installed on the development machine and it works well. I created another one today, but it won't install, saying the service already exists.
Let's call them Service A (old) and Service B (new)
I uninstalled Service A, then installed successfully Service B. Then tried to reinstall Service A but it says it already exists.
So whatever the combination, I can only install one service. I tried with Project Installer and InstallShield, both yeild the same result.
Any idea how to overcome that? If it's on any use, both services have some common dependencies (dll).
It is on Windows Server 2012.
So both your services must define the same value for System.ServiceProcess.ServiceBase.ServiceName in the subclass that is in your service project.
Search for it in one of your service projects, and replace it with an alternative name.
Related
I have a wpf desktop application (ERP) system
Application is using setup and deployment to create the .exe file
Now, i want to create a window service for my application to do some background check ups , synchronizations with my database etc.
I know how to create a service in.net and how manually to install it following the examples online.
My question is how i can install (or include let's say) this service within my .exe setup.
I don't want the user to be responsible to install the service.
Neither me to login every time someone pc to install the service
Not sure if i misunderstood the purpose of service but i found nothing online related to my question.
You can use Microsoft Visual Studio Installer Projects and include your service/main project at the same time
https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
I have a Visual Studio solution. This solutions contains two projects. The first is a class library with all methods that communicate with sql server db. The second is a windows service project will run every 30 minutes.
How do I distribute this setup in one package?
I have tried:
1-adding the class library as a reference to windows service.
2-create a setup project and adding the windows service in the application folder.
3-adding the windows service and the class library to the application folder.
this is a screenshot for the error.
I think this error because the class library couldn't reach the SQL db.
You are looking to deploy a windows service that is dependent on a DLL.
"deploy" is the standard for what you're calling "distribute". You understand the underlying concept but just realize that the standard is called "deploy".
There are details to do this here...
Windows Service Deployment
I have a 64-bit Windows Service, written in C#. It was previously installed on a Windows 7 64-bit machine. We've made some changes to it, and are trying to deploy the new version to the same machine.
However, no matter what we do, the behavior we are seeing seems to indicate that the service that is running is the old version.
Here are the steps we've taken in an attempt to resolve this issue:
Uninstalled the service using INSTALLUTIL.
Used SC DELETE to verify that it is removed.
Deleted all files from the service's installation directory, as specified in the service's properties page in the Services snap-in.
Removed any registry entries associated with the service from HKLM\System\CurrentControlSet001\Services.
Rebuilt the service and its dependencies with new version numbers.
Deployed the new version to the service's installation directory.
Reinstalled the service using INSTALLUTIL.
Verified that the Services snap-in and the registry are pointing to the correct location for the service executable.
Nonetheless, the behavior of the newly deployed service appears to be identical to the previous version. (Specifically, it is injecting messages into a queue in MSMQ, when that functionality was removed and can be verified to have been done so.)
We are positive that we are deploying the right version. This same behavior occurs even if we install the new version of the service from the Visual Studio project build folder (bin\x64\release).
Why is/would this be occurring? How do I resolve it? Are services cached somewhere and run from a cache when you install them? If so, where are they, and how do I properly clear them?
Or is this just something I've boned in the code?
i am new to windows services. please help me to know is Project installer Mandatory for Windows service or why do we need project installer. can we create and install windows service into system without project installer.
thanks,
If you're talking about the ProjectInstaller.cs file that's added to your service project if you're looking at the Service and choose "Add Installer...", then yes, it's required.
It creates two components - a ServiceProcessInstaller and a ServiceInstaller. Together, these components contain important information that is required to install a service - such as what account the service should run under (such as Local System, Local Service, Network Service or an actual user account), metadata about the service, and information about how the service should be started.
I think that DinosaurTom's answer was assuming you were talking about an installer project, a separate project in the solution that would create a setup/MSI file. It is exactly the two above mentioned components that tools such as InstallUtil or a Setup Project actually interact with to perform installation.
No, it is not mandatory. However it could be useful when installing on many maschines.
We can create a Windows Service without Project Installer. For example, like in this post Install a Windows Service using a Windows Command Prompt
I've created a windows service in c# and I'm trying to install it for debug using the installutil as recommended here: http://msdn.microsoft.com/en-us/library/sd8zc8ha.aspx
The installutil says Install completed. However, nothing appears in the service control manager.
I've tried this on Server 2008 and XP with the same result.
Any ideas?
A colleague of mine had a more or less identical problem.
Did you add an installer to your project? For the service to be installed you need to add an installer to your Visual Studio Project.
The easiest way to add an installer in Visual Studio is to open your service in Design Mode and right click the design area and select Add Installer. This will add a file ProjectInstaller.cs with itself contains a ServiceInstaller object and a ServiceProcessInstaller object.
With the installer added you can set the Service Name, Description and other options that will be used when installing the service. If you now try to use InstallUtil your service should be installed and should show up in the Services list.
I had a similar issue (build installer, no errors, no service appears in services.msc) but a different solution, as I had configured the installers.
In my case, the Service-project's Application Properties (Alt-Enter, Application-tab) Startup object was (not set) as shown below:
Picking the default .Program and rebuilding service and installer worked (service appeared in services.msc).
Setting this property is one of the steps in the MSDN service installer walkthrough referenced in this SO answer. Make sure to follow all of the steps!
I can't speak specifically to any issues that are the fault of C# or .NET, but I have a writeup of what has to happen for a service to be installed and work in the form of an extensively documented framework (source code included) for writing services in Lua. I offer it up here as an example of another way to do it, because sometimes just seeing things from another point of view can be helpful.
Disclaimer: It is very much at an alpha quality level, and yes, I am its author.
The framework has all the code needed to interact with the Windows SCM to install and remove the service.