构建使用sdk类库的服务 [英] Building a service which uses sdk class libraries

查看:60
本文介绍了构建使用sdk类库的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想创建一个控制台应用程序,它可以向Windows服务发送命令来执行以下操作:



https://msdn.microsoft.com/en-us/library/ hh329055.aspx [ ^ ]







https://msdn.microsoft.com/en-us/library/hh328971.aspx [ ^ ]



此应用程序纯粹用于测试。如果它工作,我想使用其他可以与我的Windows服务通信的应用程序。它就像一个界面。



我已经建立了一个Windows服务。但现在我需要使用这些URL中的代码。

我是否为每个动作制作单独的类和方法?但是如何从服务外部调用这些方法。我是否需要开发类库?

我希望有人可以帮我一个例子。



亲切的问候,


$ b $bAndré

Hi guys,

I want to make a console application which can send commands to a windows service to do the following:

https://msdn.microsoft.com/en-us/library/hh329055.aspx[^]

and

https://msdn.microsoft.com/en-us/library/hh328971.aspx[^]

This application is pure to test things. If it works I want to use other applications that can talk to my windows service. It's like an interface.

I have build a Windows service. But now I need to use the code in these URL's.
Do I make separate classes and methods for each action? But how can I call these methods from outside the service. Do I need to develop class libraries?
I hope somebody can help me with an example.

Kind regards,

André

推荐答案

我假设您发布了错误的网址。两者都是关于运营经理 [ ^ ],它是SCCM的一部分,用于其他范围,而不是您起草的范围。



您描述了一个简单的IPC,SCCM依赖于复杂的基础架构。有几种方法可以实现这样的IPC

1)使用自定义命令。这是一种基本方法,但是遗留方法。缺点是你只有128个不同的号码作为命令发送。请参阅本教程: http ://arcanecode.com/2007/05/30/windows-services-in-c-sending-commands-to-your-windows-service-part-7/ [ ^ ]

2)使用管道: https://msdn.microsoft.com/en-us/library/bb762927(v=vs.110).aspx [ ^ ]

3)使用一些排队系统,如这一个 [ ^ ]或 MSMQ [ ^ ]

4)使用WCF,在Windows服务中托管服务(参见: https://msdn.microsoft.com/en-us/library/ms733069%28v=vs。 110%29.aspx [ ^ ])。如果你愿意,这可以是RESTfull,这通常是一种更好的方法,但取决于预期的用途。

5)Windows服务中的WebAPI服务hosteh(参见:https://github.com/danesparza/OWIN-WebAPI-Service [ ^ ])

也可能有其他人,但我认为这些就足够了。
I assume you have posted wrong URLs. Both are about Operation Manager[^], which is part of SCCM, and it is intended for other scope than the one you have drafted.

You described a simple IPC, SCCM relies on a complex infrastructure. There are several approaches you can follow to implement such IPC
1) Using custom command. This is a basic method, but a legacy one. The drawback is that you have only 128 different numbers to send as command. See this tutorial: http://arcanecode.com/2007/05/30/windows-services-in-c-sending-commands-to-your-windows-service-part-7/[^]
2) Use pipes: https://msdn.microsoft.com/en-us/library/bb762927(v=vs.110).aspx[^]
3) Use some queing system like this one[^], or MSMQ[^]
4) Use WCF, by hosting the service in a Windows Service (see: https://msdn.microsoft.com/en-us/library/ms733069%28v=vs.110%29.aspx[^]). This can be RESTfull if you want, which is a better approach in general, but depends on the intended use.
5) WebAPI service hosteh in a Windows Service (see: https://github.com/danesparza/OWIN-WebAPI-Service[^])
There might be others too, but I think these will be enough for the start.


感谢您的提示。没有URL是对的。 SCOM有一个SDK,我希望结合Windows服务。
Thanks for the tip. No the URL's are right. SCOM has an SDK and I want to combine wit a Windows service.


这篇关于构建使用sdk类库的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆