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).
我需要开发windows服务,它将每隔两周向系统传输文件。问题是我还需要“RunNow”方法,用户可以随时通过点击web应用(asp.net mvc)中的链接调用transfer方法。
How can I call my windows service methods from external resource?
如何从外部资源调用windows服务方法?
2 个解决方案
#1
2
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.
如果您想在web应用程序的服务器端调用windows服务方法,请查看WCF或RestSharp和Nancy。很快,您需要在windows服务应用程序中创建一个RESTfull服务,该服务将使用http://localhost/myservice/transfer地址来公开传输方法。然后使用javascript代码中的ajax或.net-controller类中的RestRequest来调用地址。但是,如果您想在应用程序的客户端调用windows服务方法,这将是一个问题。
#2
0
You could use Microsoft Message Queuing
您可以使用Microsoft消息队列
The Webapplication would send a Message that the Service picks up.
web应用程序将发送服务接收的消息。
Queue-Based Background Processing in ASP.NET MVC Web Application
ASP中基于队列的背景处理。净MVC Web应用程序
http://msdn.microsoft.com/en-us/library/ms978430.aspx
http://msdn.microsoft.com/en-us/library/ms978430.aspx
#1
2
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.
如果您想在web应用程序的服务器端调用windows服务方法,请查看WCF或RestSharp和Nancy。很快,您需要在windows服务应用程序中创建一个RESTfull服务,该服务将使用http://localhost/myservice/transfer地址来公开传输方法。然后使用javascript代码中的ajax或.net-controller类中的RestRequest来调用地址。但是,如果您想在应用程序的客户端调用windows服务方法,这将是一个问题。
#2
0
You could use Microsoft Message Queuing
您可以使用Microsoft消息队列
The Webapplication would send a Message that the Service picks up.
web应用程序将发送服务接收的消息。
Queue-Based Background Processing in ASP.NET MVC Web Application
ASP中基于队列的背景处理。净MVC Web应用程序
http://msdn.microsoft.com/en-us/library/ms978430.aspx
http://msdn.microsoft.com/en-us/library/ms978430.aspx