我可以使用svchost.exe来托管我自己的服务吗?

时间:2022-11-19 10:08:20

I can't find documentation for how to do it, which makes me think I'm not supposed to do it.

我找不到如何做的文档,这让我觉得我不应该这样做。

3 个解决方案

#1


No, svchost.exe is undocumented and only supported for services that are part of Windows.

不,svchost.exe未记录,仅支持Windows中的服务。

Part of the reason is reliability - a crash in a 3rd party service should have no effect on a critical Windows service.

部分原因是可靠性 - 第三方服务中的崩溃应该对关键的Windows服务没有影响。

Why do you want to use svchost? Do you have several services that you want to combine together? Creating your own exe to host multiple services is pretty straightforward.

你为什么要使用svchost?您想要将多种服务组合在一起吗?创建自己的exe来托管多个服务非常简单。

#2


Comment in this link will help you out, its too much to cut/paste here. Source is C++ as you didn't specify a language I dont think it will matter.

此链接中的评论将帮助您,在此处剪切/粘贴太多。源代码是C ++,因为你没有指定一种我认为不重要的语言。

The Link

EDIT: For the record, I am not saying it's a good idea.

编辑:为了记录,我不是说这是一个好主意。

#3


You can download the windows NT resource kit (http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en), and follow these instructions to create a service out of anything: http://support.microsoft.com/kb/137890

您可以下载Windows NT资源工具包(http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-ae7-96ee-b18c4790cffd&displaylang=en),并按照这些说明创建一个服务任何东西:http://support.microsoft.com/kb/137890

#1


No, svchost.exe is undocumented and only supported for services that are part of Windows.

不,svchost.exe未记录,仅支持Windows中的服务。

Part of the reason is reliability - a crash in a 3rd party service should have no effect on a critical Windows service.

部分原因是可靠性 - 第三方服务中的崩溃应该对关键的Windows服务没有影响。

Why do you want to use svchost? Do you have several services that you want to combine together? Creating your own exe to host multiple services is pretty straightforward.

你为什么要使用svchost?您想要将多种服务组合在一起吗?创建自己的exe来托管多个服务非常简单。

#2


Comment in this link will help you out, its too much to cut/paste here. Source is C++ as you didn't specify a language I dont think it will matter.

此链接中的评论将帮助您,在此处剪切/粘贴太多。源代码是C ++,因为你没有指定一种我认为不重要的语言。

The Link

EDIT: For the record, I am not saying it's a good idea.

编辑:为了记录,我不是说这是一个好主意。

#3


You can download the windows NT resource kit (http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en), and follow these instructions to create a service out of anything: http://support.microsoft.com/kb/137890

您可以下载Windows NT资源工具包(http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-ae7-96ee-b18c4790cffd&displaylang=en),并按照这些说明创建一个服务任何东西:http://support.microsoft.com/kb/137890