views:

508

answers:

3

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

+3  A: 

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

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

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.

Michael
True, but its not because of reliability, because you can host different services in separate instances of svchost.exe (MS does this).
DSO
The presumption is that 3rd party code may be less reliability that Windows provided services.
Michael
One thing to consider: Because svchost is internal to Windows, the API contract for hosted services can (and has) changed without warning. Your app WILL break if you choose to go down this route. You'd be better off writing your own service host.
Larry Osterman
+2  A: 

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.

The Link

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

Serapth
+1  A: 

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

Kevlar