Vaccano
Vaccano

Reputation: 82341

Simple way to get a .net DLL to run as a Windows Service

I have an NServiceBus project (Class Library) that I would like to have run in a Windows Service (right now it uses the NServiceBus.Host.exe)

I would like to be able to put as little around my dll as possible. What is the simplest way to get a dll to run as a Windows Service?

I would rather not make an separate installer, but if I have to make an installer, I will.

Upvotes: 2

Views: 6157

Answers (4)

driushkin
driushkin

Reputation: 3659

Afaik, NServiceBus host uses TopShelf underneath. Anyways, this should be what you are looking for: http://nservicebus.com/GenericHost.aspx > Installation

Upvotes: 1

Philip Rieck
Philip Rieck

Reputation: 32568

While I haven't used it myself, some peers have enjoyed using TopShelf - apparently the nicest feature (well, the one they liked) is being able to update the service with an xcopy instead of having to stop/remove/install/start every time.

Upvotes: 1

CodingGorilla
CodingGorilla

Reputation: 19842

There is no simpler way than writing a windows service that wraps your library. You will need something that does the work of communicating with the Service Control Manager (responding to start, stops, etc) and also handles the "main loop" for the service. The only way to do that, other than something someone else has written (like NServiceBus.Host.exe) is to write one yourself.

Upvotes: 3

AK_
AK_

Reputation: 8099

Windows Service Applications

And just call the class library from the service...

Upvotes: 1

Related Questions