So I have researched through MSDN and SO, but have not found the answer to a question asked quite this way: I have an app that will be turned off/on, and as part of the install/update, I want to have a Windows service get updated as needed also as part of the install to the primary app. The Windows service will provide data to the app, but if the app changes, the service may need to provide more/different data.
I looked at TopShelf as someone suggested on a different post, and seeing that makes me wonder if I can use TopShelf to deploy the service at the same time as the app itself - in other words, wrap the whole thing in ClickOnce, let TopShelf do the Windows Service part, and ClickOnce finish by doing the app part. Does that sound like a decent strategy?
Ok, so I found my answer: ClickOnce doesn't do what I want, because Microsoft said so (under "Next Steps"). But their suggestion is to include a class called ServiceController which can talk to your service from your application, and do any Service manipulation that you want. (TopShelf doesn't appear to be necessary.) I like this because it allows everything to be under one roof, and is elegant...It should solve permissions issues and other barriers to simplicity of installation - we want this to be as easy and seamless for our
customer as possible.
Related
I am new to the Winium world. I tried playing with Winium.Cruciatus which seems to be working fine but not perfect.
Hence, I am thinking to try Winium.Desktop.Driver.exe which I understand -
is a Selenium-compatible wrapper for Cruciatus, and
it is required to be running separately while development.
However, I wanted to understand that once the development is done and
if the solution is deployed in production, will it
(Winium.Desktop.Driver.exe) still be required to be running in advance
for the solution to work?
My requirement:
To automate the installation of a software on multiple VMs (domain joined) from one single VM.
If (yes)
{
I think it may block the installation if it requires explicit Admin
permission to run. As we cannot go on each machine to click on 'Yes',
which defeats the purpose of automation.
Because my environments will be Windows Server 2012 R2 and most of
the time they are more restricted than a normal Windows like Win10.
}
If (no)
{
Any specific advantage of using Winium.Desktop.Driver vs only developing with Cruciatus library?
}
Note: Can someone of high reputation please create a new tag - 'Winium' as it seems this is required now as we already have few more questions
on Winium.
Winium.Desktop is a testing tool, it is usually used to automate end-to-end or other functional testing scenarios. When it is used as testing tool, then it is only required during development/testing phase, not in production.
But if you use Winium.Desktop not for testing, but as an automation tool, for example to automate installation of a software, i.e. Winium.Desktop is a core part of solution that runs setup program and clicks next or something, then you will need Winium.Desktop during deployment phase.
Key advantage of Winium.Desktop over Cruciatus is that it provides Selenium interface and works as client-server, which is useful for test automation, as client-server can be scaled, and Selenium interface is well known and there are a lot of tutorials on how to use it.
If you just need to automate installation of some software (i.e. do not need to do actual testing using Winium), I would suggest looking into direction of one of IT infrastructure automation tools like Ansible, Chef, etc.
Regarding admin rights I suggest to open an issues at https://github.com/2gis/Winium.Desktop/issues describing your use case, probably there is a way to run it without admin rights or grant access only once.
On the https://msdn.microsoft.com/library/windows/desktop/ms683502 page (v=vs.85) of .aspx/ it is written as to make that the service worked in an interactive mode. There it is written that it is necessary to cause the CreateService function. I not absolutely understand where it needs to be done. I use C# Visual Studio 2013 for creation of service from the Windows Service template, but there didn't find anywhere to execute required in article Microsoft. I ask prompt. Very much it is necessary to create interactive service on C#. I will be glad to any help.
A similar question has already been asked although unfortunately it might not be the answer you like.
In summary interactive services are frowned upon due to security risks and is not supported since Windows Vista. Although there is a documented workaround presented here which applies to C++ code where service is created using the WinAPI call of CreateProcessAsUser.
Other than the above, if you elaborate your problem a bit more we could provide alternative solutions.
We are faced with the problem maintaining lots of windows services.
The idea is to reorganize windows services in to class libraries and connect libraries to one master windows service. Is there a good idea ? Any advices please)
There is a framework for hosting "services" within a single Windows Service called TopShelf. You might want to consider using that. https://github.com/Topshelf/Topshelf
I am interpreting your question to be "We have tons of little Windows applications that run as services - how can we simplify them?".
In general, lots of smaller programs are better. Single monolithic applications are difficult to maintain and test; when someone needs to make a small change it can trigger catastrophic consequences for dozens of other components of the application. It can also make it impossible to change one small application without taking down the whole service, as Chris Knight comments above.
On the other hand, lots of small programs suffer from the breadth problem. You probably want to make sure all your little programs run on a consistent framework - i.e. they all log their results to the same place, they all use a standardized configuration system, and they are all managed in the same place.
I have seen situations where people write services because they need to run a task "when a particular condition happens", so they make it a constantly running service and continuously check for that condition. Is it possible that you could take some of your services and turn them into triggered launches of individual applications?
If this isn't the correct interpretation, please let me know :)
I’m currently writing a windows service that’s sole purpose in life is to poll a database and, based on the resulting information, update some other data. I wrote this as a windows service because it seemed an ideal platform. I don’t need any user interaction.
However, while developing it, I’ve noticed one or two issues that make developing a windows service more time consuming that developing a straightforward windows app. Has anyone has any experience with this kind of choice? What is the best practice for this kind of app? Are there any reasons why using a windows service is preferable?
The issues of development imoho are far out weighed by the features that services provide. Remote polling, no need for a user to log on, built in fault recovery and monitoring.
I just made my first service too and noticed they are not quite as easy to debug or test. You can install and start the service then attach the debugger to the process. Or you can run the service as a console app just to test out functionality. Something like this http://tech.einaregilsson.com/2007/08/15/run-windows-service-as-a-console-program/
Whether a service is preferable or not is your call. rerun listed good reasons for services. Based on your description it sounds like a scheduled task of some SQL would accomplish what you want.
To debug a windows service directly under visual studio , Add this Code snippet to your service designer class under Main() .
Shared Sub Main()
#If DEBUG Then
Dim service As New YourServiceClass
service.Execute()
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
#Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
'More than one NT Service may run within the same process. To add
'another service to this process, change the following line to
'create a second service object. For example,
ServicesToRun = New System.ServiceProcess.ServiceBase() {New YourServiceClass}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
End Sub
This is vb.net code but C# should do the same trick. I have managed several windows services like this without any issues. If debug should be preceded with a hash.
One thing you should be aware of is that a service will not be able to use video hardware acceleration. If you are not doing any graphical work then you can safely ignore the limitation, but if you have graphical-intensive operations (for ex. WPF-related) you have to keep this in mind.
I admit it's not a common scenario, but I've worked on a project where a service rendered WPF controls.
The reason for this is Session0 isolation, described here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Let's say for example you have 5 different companies using the same platform (Windows based) all wrote their own web services, what technique using C# and .Net 3.5 would you recommend using to monitor all their different web services?
My intention is to build an application that provides visual feedback on service statuses to site administrators and of course e-mail/sms alerts as needed. Is there a best practice or methodology to follow in your opinion?
In addition, are there any windows based tools available to perform this that I'm unaware off? Preferrably open-source?
*Edit: Think of the end result, an application that just shows a red or green light next to the services running across the different companies.
Company 1
> Web Service 1 - Green
> Web Service 2 - Green
Company 2
> Web Service 1 - Red
> Web Service 2 - Green
You should try PolyMon, a .NET based, open-source monitoring tool on CodePlex:
http://polymon.codeplex.com/
At least for our case, it hit the sweet-spot of functionality and a lean and easy setup.
You can choose from some out-of-the-box tasks like Ping or URL monitoring, but you can also easily implement your own more complex tasks. Works quite well for us.
The tool itself is not distributed, but you can easily set up two instances of the service (e. g. on servers in different locations) and monitor the same services, or use one instance to monitor the other.
We experienced just one issue that was very annoying and a little freaky, when a server that was running both PolyMon and the SQL Server instance used by PolyMon repeatedly crashed on reboots (endless loop of reboot). Seems to be some kind of race condition. Therefore I strongly recommend to host the PolyMon service and the SQL Server service on different (virtual) machines, or set the start-up type of the PolyMon service to "Manual" instead of "Automatic", and start PolyMon manually after everything else booted, to avoid this problem.
Big Brother System and Network Monitor, will probably do most of what you want. It is extensible and plug-ins can be written in any language. They have a free editon of their monitoring software:
http://www.bb4.org/home1.html
You should also use a local monitor on each server that is being monitored. This is because it is difficult to diagnose problems remotely. This blog has a good discussion of the problem and details of a local monitor design pattern:
http://sleeksoft.co.uk/public/techblog/articles/20041218_1.html
The most commonly used open source monitoring tool is Nagios. Built in it has support for many different services, and you can always write a script or app to test any service not already supported.
Nagios Home Page
Windows Monitoring Service
Instruction for setting up Windows service
If they write aspx web services, all monitoring best practices described for ASP.NET applications, like ASP.NET Health Monitoring Overview MSDN article and in ASP.NET Health Monitoring are applicable
Also see an SO question Tools and methods for live-monitoring ASP.NET web applications?
Standard tools will allow you to ping the IP or probe the HTTP port - these are cheap & simple ways of verifying that the web service is minimally available. In order to validate that they are also fully functional, you will need to do a bit more... your monitoring package will need valid credentials to login to the various web services, not to mention specific proxies & business logic to execute against each one.
Have you looked at MOM (especially MOM management packs)?
There are tools like IPSentry with which you can make HTTP requests and check the returning data...
I know this is a pretty old thread but thought I would add Wolfpack to the list for anyone still looking for a "distributed system monitor" - Wolfpack was designed (by me) as exactly that. It can run multiple "agents" collecting data about the servers they monitor and reporting it to a central server instance.
It has a rich set of monitoring and storage plugins and you can easily roll your own for custom checks (there are numerous supporting nuget packages available - just search for Wolfpack on nuget.org) plus there is an active contrib project too...and its really easy to install via chocolatey.org (cinst wolfpack)!
It is open source and completely FREE! I'm also rewriting major parts of it at the moment for the next v3.0 release and it will support SignalR alert notifications, powershell and a full web api/interface (via ServiceStack).