Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call windows service methods from web application

I need to develop windows service which will do fortnightly transfers of files into the system. The problem is that I will also need "RunNow" method, so users can call transfer method any time by clicking to the link in the web app (asp.net mvc).

How can I call my windows service methods from external resource?

like image 610
Gab Avatar asked Oct 25 '25 00:10

Gab


2 Answers

If you want to call a windows service method on the server side of your web application then take a look at the WCF or RestSharp and Nancy. Shortly, you need to create a RESTfull service in the windows service application that will be using a http://localhost/myservice/transfer address to expose the Transfer method. Then use ajax from your javascript code or RestRequest from your .net-controller class to call the address. But if you want to call a windows service method on the client side of the application it will be a problem.

like image 179
sedovav Avatar answered Oct 26 '25 14:10

sedovav


You could use Microsoft Message Queuing

The Webapplication would send a Message that the Service picks up.

Queue-Based Background Processing in ASP.NET MVC Web Application

http://msdn.microsoft.com/en-us/library/ms978430.aspx

like image 23
Mathias F Avatar answered Oct 26 '25 14:10

Mathias F