I am working on windows service application that is suppose to perform some tasks. Apart from these tasks, I want to make some of the service functionality available on call. Means, totally separated application should be able to create an object of type specified on windows service and can call some of the functions, decalred public, ofcourse.
Let me know if is there any way to expose the functionality through API or something. if yes, kindly guide me to any tutorial or example of that.
Thanks in advance.....
I think what you are looking for is a windows service using WCF to communicate with other applications.
Here's a pretty neat tutorial you can work through:
http://tech.pro/tutorial/855/wcf-tutorial-basic-interprocess-communication
Related
I am new to WCF services and I have made one. It has 8 functions and I tested them in client desktop app, all work fine. My main task is to use those functions in REST service. I passed a tutorial:
http://www.asp.net/web-api/tutorials/hands-on-labs/build-restful-apis-with-aspnet-web-api
and I understand what I need to do, but I don't know how to start, because I don't know which type of project to use and how to make it work. Besides the fact that I need to make this REST service, I didn't get any further instruction.
So, if anyone has an idea or any tip, I would be thankful.
may below artical would be help you
http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide
I need a good and easy way to "Talk" to a windows service in C#
I have been able to create a windows service and start, stop, pause and continue it using a windows forms application.
My question is
Which is better and/or easier to accomplish this? WCF or Named Pipes? Or is it easier to do it using a file and make the service check it after some interval continuously?
I am very unfamiliar with both concepts(wcf and named pipes). So basically what i am asking is:
Which is worth my time? WCF or Named Pipes?
Thank you in advance :)
Ok, just provide a simple interface in c# with the following codes for doing what you wanted start,stop,restart etc
http://www.csharp-examples.net/restart-windows-service/
additionally, you may want to look into
SC commands which are specifically a way to interact with windows services..
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx
or even WMIC for remote access
http://msdn.microsoft.com/en-us/library/ms186146%28v=VS.80%29.aspx
I am working on a client server project. Client is built in WPF using mvvm pattern and service is built using WCF. I have to perform some action on a specific event which I am able to do by calling some service functions. I will have to do call the same function on a regular basis at a specific time as configured in database. Can somebody suggest a better approach to achieve this. I am thinking of creating a windows service specifically to do such things. Is that a good choice ? Thanks a lot.
Create a console app that calls the service, and add a scheduled task in Windows to run the console app at a specified interval. It is a lot easier and cleaner than creating a service for such a simple application.
I think the best approach is to use an already created (and properly tested) scheduling system or library instead of developing your own. For a Java project I worked on, I used the Quartz library, which handled the job quite nicely and it integrated easily into said project. It has a .NET port here, never used it but I suppose it works similarly.
We have a web service written in C# running on Window 2008. We have two applications that need to access the web service. One written in C# and the other is in Java. We want to develop an over-arching architecture so both can call on the web service without us having to write two separate interfaces. Does anyone know the best approach for this?
Answer : To use Window Communication Foundation WCF.
i have an requirements where i need to have two instances of the custom window service code running at the same time but only one should be doing the work until the other one fails or die.
i'm trying to come up with the clean and simple design to do this.
one way:
create a temp table
and have this two service talk to each other via the table
and if the running one goes down, using probably last modified date
time on the table
then the other one will start
but this is very manual. i'm using c# 4.0.
are there better ways to achieve this?
i saw there's something like EventWaitHandle but not sure if it would be simple to use it.
thanks
~m
Implement a kind of lock/mutex using a common database (as you mentioned)
If the instances on the different servers know of each other (config?), they can chat with each other and decide who's boss.
If the instances do not know of each other try using an UDP broadcast to announce themselves to each other and then decide who's boss.
If you are able to do #1 and do it generic exposing it through a web service that solution would be reusable for other applications as well. I use such a solution myself.
Consider exposing a ping api endpoint (simple Rest API ping method) on both services so that each can monitor the other service state.