Copying Windows Service to Server - c#

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!

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

VB.NET published windows app doesn't run

TOOLS:
Windows 10 Pro
Visual Studio 2017 Pro
I created a VB.NET windows app GUI on my desktop computer,
published it,
copied the publish\ directory to a new target laptop,
logged into laptop and ran publish > setup.exe
it asked me to "install" and I said YES,
and app started, but hung, never displaying the GUI.
My app has two .DLL's of mine, but they are not in the publish\ directory.
I made a HELLO WORLD on original desktop, published, and it ran ok at laptop.
All of your dlls need to be distributed with your application.
Try manually move your dlls in the same folder of .exe file on target machine: if it works simply rebuild your setup incuding these dlls as dependencies.
The problem is solved. The target laptop needed installation of drivers from a vendor of some 3rd party middleware used in the app.
So, the packaging software wasn't smart enough to tell me the problem, and its error correction response was to just end without any error message.

Installing process as service directory decision

I have a process that is going to run as Windows Service.
I have successfully installed it as Windows Service and everything works.
My question is what are the guide lines for process directory.
On the machine Im going to deploy it, does the setup need to copy the .exe to Windows/System32 and then install as service ? Or i can deploy it to C:\MyApp\MyApp.exe and install as service from there.
It is not required for the .exe to be in /Windows/System32/ but is it "Best practice" ?
No. You shouldn't install anything to the Windows System folder. That's for operating system code.
You should install to your own application folder within the Program Files folder, and register as a Windows service thereafter.

error when installing windows application on other pc

I had windows application and I published it and I installed it in other pc and when I was installing in this error apeared(you cannot run application that require that assembly microsoft sql server.connection info 9.0.242.0 ......)
Random guess...
You need with either SQL Server native client or SQL Server SMO. or both
You say "published" so I'm guessing it's a ClickOnce deployment.
One gotcha of the automated ClickOnce deployment (at least, it was as of VS2008) is that it doesn't automatically pick up the dependencies of any projects you reference in the project you publish from - you have to add the references into your main project by hand, then they will be added to the manifest, and then deployed to client machines upon installation.
Hope this helps.

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.

Categories

Resources