How to call an already running windows service? - windows

Is there anyway to call a windows service that's already running or a process to get info? What my goal is to find out if my windows service is an infinite loop or dead lock and see if it responds. So I want to be able to pass an argument from another program to a windows service and want it to to return a string or number. Is this possible? I can change the windows service to accommodate this. I am thinking of an event or something.
Note: I am not supposed to have the service write to a file or database.

You can host a WCF service in your Windows Service which you could call to get status information.
Here are a couple of links on doing that:
Can I host a WCF Service in a windows service?
How to: Host a WCF Service in a Managed Windows Service

Related

make a windows service from executable

I'm looking for a way to create a Windows service from an executable that is not a service itself. Do I need a wrapper service to response Windows service calls that calls non-service process?
Note: I'm familiar with SC.EXE and how to make a service. unfortunately when starting services made from non-service executable, I'm getting 1053 timout error.
Try to look on how to use srvany.exe, it should be a tool allowing to launch an app as a service.

should back end service for windows phone push notificatin always be a cloud application?

I want to develop an application that makes use of MSPN service. Is it necessary that my backend service be a cloud service
There would be no way to determine if a service is a cloud service or not (without being anti-competitive), so you should be able to use any web service, whether it is implemented using a cloud service such as Azure or not - as I understand it, for certification, it would have to be a web service, and not rely on something being installed on a PC on a private network.
No you dont need it to be a Cloud-Service, you can even implement your Push-Service in PHP or similar. But that has Limits, it cannot run periodically a Script or sth like that. All Push-Notifications have to be send manually.
To do this you need 2 Core-Components(In my example in PHP).
You have a Page on which the Phone-Application can register his MSPN Push-Uri, which then is stored into the Database.
A Page which takes the Uri(s) and then sends the Push-Notification to them

How to start a windows service on local computer

I have created a windows service.
When I install msi, this service goes to local services, but doesn't start. When i try to start it, it gives this error:
Windows could not start this service on Local computer.
Error 1053: The service didnot respond to the start or control request in a timely fashion.
One more thing is, that when I install msi as a service, it goes to local services, but doesn't start and gives warning that you don't have privileges to start this service.
Once you have created the service, go to "Services", and find the service you just created.
Right click on the service name, and select Properties. Under Log On, make sure the service is using an account that has permissions to the machine and anything your service needs. The default account is a Local System account, which has access to the following .
Microsoft has a couple of fixes to this problem here and here. They might help you.

wcf windows service interaction

I have a windows service in which i host a wcf service.
What is the best approach to control the windows service via the wcf service? I already created the interfaces for the wcf service, but I have no idea how to interact with the windows service's classes and functions.
just to check that I'm understanding your problem correctly - you want to run a wcf service, so you create a windows service to host it, and you want your desktop client to be able to control the windows service (that's hosting the wcf service) by talking to the wcf service?
If that's the case, what is it that you're trying to do with the windows service? In some of the work I've done, I've set up the server such that there's the windows service hosting all the wcf services I want to run, and in order to interact with that windows service remotely (e.g. starting/stopping/restarting) I have another service running on the server (usually baked into the Amazon instance image so it's running on every new server that gets brought up) which my remote client can talk to instead. That way I have a means to trigger a service restart on all my servers without having to manually connect/remote desktop to each server. Of course, the second wcf service is secured by some means so it can't be exploited easily.
Is that the sort of thing you're looking to do?

Writing Windows service in WCF

I want to write windows service in wcf After searching a lot I only found were tutorials of writing webservice in wcf not windows service.
Can any one please provide a link to any tutorial which explains how to write windows service in WCF
Windows services are executables. WCF applications are, generally, web services, exposed over a URI. You can host a WCF application within a windows service, not the other way around.
To create a Windows service in C#, follow the step-by-step here. To make your Windows service WCF-enabled, if you will, create the System.ServiceModel.ServiceHost instance that will host your WCF service inside the OnStart() callback.
Good answers all of them. Just a quick note... implement your WCF service in a class library (dll) so you can then host it anywhere you like (IIS, Console App, or Windows Service).
I'd recommend starting from a console application, after your service works as expected, create a Windows Service, add a reference to you library and start the service (WCF) from there (Windows Service)
Edit: I just assumed you meant create a WCF service hosted as a Windows Service, if that's not the case please ignore my answer.
Create your WCF service as normal, create a Windows Service and then use ServiceHost to self-host the WCF service in your Windows Service. See this MSDN page for more information about self-hosting WCF services.

Resources