Gab
Gab

Reputation: 531

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?

Upvotes: 4

Views: 15643

Answers (2)

Mathias F
Mathias F

Reputation: 15901

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

Upvotes: 1

sedovav
sedovav

Reputation: 2046

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.

Upvotes: 3

Related Questions