Problems Installing a Windows Service from a Visual Studio Installer Project - c#

The reason I ask is that I must be doing it incorrectly as I am having a lot of problems and I feel like I am chasing my tail here.
Using the how-to here, http://msdn.microsoft.com/en-us/library/zt39148a.aspx, and that works great.
So this windows service that I have built is a part of a solution that contains an ASP.NET MVC3 web UI, a class library business domain, and an installer for the windows service. Both the windows service and the MVC3 app reference the class library. I've marked only the Windows Service project as the "primary output" in the installer app.
Now, after a reboot, I can do build the installer and install the service and it runs great. However, after that first time, I have nothing but problems. In visual Studio, the uninstall option is grayed out, which is wrong, it should be active. I can uninstall in Windows but for some reason the process is still running. From there I cannot rebuild the installer project because the exe won't delete and is still running.
Where am I going wrong?

Related

C# windows service install with desktop application

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

Copying Windows Service to Server

At the moment I have a Windows Service and App (Desktop Tray Win Form App with Stop/Start buttons to stop the service and a PING to check the 3rd party API it uses it working and obtain the current balance - It's a Betfair Betting app)
At the moment I am running this off my Win 7 64 bit Desktop but we are moving to a dedicated server Win 2012.
Both the Win Service/Form are in the same project and they reference a DLL which I made that has all the code inside (connects to the DB, 3rd party Betfair API, gets runner/winner info, renews session info etc).
The Windows Server does NOT have Visual Studio on it.
Can I just copy my DLL up to the server, put it in Windows/System32 and Regsvr register it and then copy the .EXE for my Form and Service up to the server?
Also without having the VS Toolset to register a Win Service on a machine what commands do I need to run to install the Windows Service on the Server.
These are 2 distinct solutions, one with the DLL code, one with the Service Project and Win Form Project.
I just want to know the best/quickest/easiest/proper way of getting it to work on the new server without having VS on it to register the service.
Can I just copy the code up to a folder (should it go in a specific folder on the server - the log files are piped out into it's own sub folder of /programdata) and run installutil [PATH TO EXE] to install the Service or is there something more I need to do.
As there are two solutions I can't (or don't know how to) create a deployment package with all the right links and references in across solutions.
However should it be more complicated than..
-Copy DLL to System32
-Regsvr my DLL
-Build the service/win form project on my computer then copy the .EXEs up somewhere
-Run installutil [PATH TO EXE] to register the service
-Double click the windows form to open it (should auto start on reboot and sit in desktop tray)
All in .NET 4.5, Was built in vs 2012, 64 bit, C#
Thanks for any help in advance
Creating a deployment package is the better option, but, because it's not a option for you, the regsvr32 and installutil option should do the job.
Hope it helps!

visual studio 2013 needs internet connection to load symbols

I have created an application that needs to run on a standalone machine that has and cannot have any internet connection.
Everything was going well until I tried to run the app in visual studio 2013. I have found that I need to be connected to the internet when I first run the app in the IDE. The issue is that it seems to need to load symbols from application extensions. I have used a few extensions, xceed WPF toolkit, BrainboxesIO, Log4net, SnmpSharpNet. After the app runs once it doesnt need to happen again until I reboot my machine. How can I prevent the need for internet connectivity, firstly whilst developing in the IDE.
I have tried to deploy my app. I can create a setup project. But as soon as I use the configuration manager to go to release, I lose reference to the same extensions. If I create a .msi in debug the app runs, but again needs the internet when it first runs. I can then disconnect and it runs provided I don't reboot, which is obviously not what I need.
Anyone have any idea what I'm not doing right?

C#: Making an Installer that installs both a WPF application (ClickOnce) and a Windows Service

I currently have a VS Solution with 2 projects: a WPF application and a Windows Service.
Now, I have managed to get ClickOnce working in installing my WPF application, but I also want a Windows Service to be installed (the one in the project) during this installation.
I have found ways how to programmatically start a windows service with C# code, but is there any way to incorporate this in my ClickOnce installation (because I need ClickOnce's benefit of automatic updates and such)?
I don't think you can deploy a windows service via ClickOnce in a normal fashion.
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/1bb64760-9622-4ca6-a1a6-3ce53e641f21
ClickOnce deploy a Windows Service?
Please check DDay Update library it might give you ClickOnce stuff for updates, but first install you've got to do using another too.
Can you execute a process during the ClickOnce install? You might be able to write the service using Topshelf and then execute MyService.exe /install from ClickOnce.

Installing a Windows Service - No error but it isn't in Service Control Manager

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.

Categories

Resources