Questions tagged [topshelf]

Topshelf is a service hosting framework for building Windows services using .NET.

Topshelf is a cross-platform (Windows and Mono) service hosting framework for .NET. Provides a simple fluent API for service configuration.

Source code is available for download on github and documentation/examples are available on the Topshelf project site and Topshelf documentation.

336 questions
71
votes
4 answers

Installing a Topshelf application as a Windows service

Using Visual Studio Express 2012, I've created a console application using Topshelf (Version 3.1.107.0). The application works as a console application, but I can't figure out how to install it as a service. I've published the project from within…
Brendan Reynolds
  • 941
  • 2
  • 8
  • 17
36
votes
5 answers

Console.WriteLine() inside a Windows Service?

I am currently using TopShelf with a Console Application to create a Windows Service. When I run the code as a console application I use a few Console.WriteLine() to output results. Once the code does what it is supposed to do I install the console…
Thomas
  • 5,618
  • 6
  • 40
  • 79
23
votes
7 answers

Serilog in Windows-Service not writing to logfile

I am using Serilog within an TopShelf Service, logging to the console and a rolling file. When running the service in a console my messages are written to the logfile, but when I install the service and run it no logging occurs. Is there anything…
Gope
  • 1,522
  • 1
  • 11
  • 18
23
votes
1 answer

How can I use CommandLine Arguments that is not recognized by TopShelf?

I want to pass some custom arguments to the console app when I install and start it as a Windows Service via TopShelf. When I use: MyService install start /fooBar: Test Console application fails: [Failure] Command Line An unknown command-line…
pencilCake
  • 45,443
  • 73
  • 211
  • 346
21
votes
2 answers

what is the difference between HostFactory.Run and HostFactory.New

I've a need to use topshelf in the project I'm in and have a simple question I hope. Everything works just fine when I'm using HostFactory.Run, but I thought that it seemed more reasonable to use HostFactory.New by just reading the name on the…
Tomas Jansson
  • 20,796
  • 9
  • 68
  • 121
20
votes
6 answers

How to catch exception and stop Topshelf service?

I have a topshelf windows service where I want to do some checking (i.e. if an xml file exists) and if the check fails I need the windows service to stop. So I tried doing the check in the Start() method and then raise an exception: public void…
JD.
  • 14,235
  • 21
  • 75
  • 149
15
votes
1 answer

Topshelf enabled windows service won't debug

Using Visual Studio 2015. Created a windows service project. I'm trying to use topshelf, but can't seem to debug. Output debug / window says: Topshelf v3.3.154.0, .NET Framework v4.0.30319.42000 Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception…
maplemale
  • 1,848
  • 19
  • 32
15
votes
1 answer

Serilog topshelf integration not working

I'm trying to set up a simple logging configuration for my Windows service using Topshelf and Serilog (the Serilog.Extras.Topshelf package respectively). HostLogger.UseLogger(new SerilogHostLoggerConfigurator(new LoggerConfiguration() …
xvdiff
  • 2,079
  • 2
  • 19
  • 44
15
votes
2 answers

TopShelf install multiple of the same service on the same machine

I am trying to create windows service using TopShelf. Everything works fine with one instance of the service. However, when I copy the whole service folder to a different location and then run the installation at the location it just hangs on…
Eatdoku
  • 5,949
  • 13
  • 57
  • 93
13
votes
3 answers

How to detect if Topshelf is running in console mode

I am using Topshelf combined with FluentSchedule for a Windows Service. However, I want to be able to trial-run the application to simply start up and not execute the FluentSchedule code that sets up the timer etc. Is there a way when running the…
Redeemed1
  • 3,786
  • 7
  • 33
  • 59
11
votes
2 answers

C# Topshelf TimeoutException

As a First step I created Windows Service project configured it properly and On second Step I have added TopShelf Version 3.1.135.0 in my project If I run my service through (F5 Run) then it is loading Top-shelf Console and service is completed…
sandeeMPS
  • 217
  • 3
  • 12
10
votes
1 answer

How to handle async Start() errors in TopShelf

I have a TopShelf service that uses async code to connect to web services and other application servers. If it's unable to initialize its connections on startup, the service should log some errors and gracefully stop. I've had a look at this…
Hydrargyrum
  • 2,752
  • 2
  • 23
  • 35
9
votes
2 answers

What could be rate limiting CPU cycles on my C# WCF Service?

Something very strange started happening on our production servers a day or two ago regarding a WCF Service we run there: it seems that something started rate limiting the process in question's CPU cycles to the amount of CPU cycles that would be…
HarveySaayman
  • 333
  • 3
  • 12
9
votes
3 answers

How to specify command line options for service in TopShelf

I am using command line arguments to pass some configuration to the windows service (it will be few instances with different command lines). My code looks like this: HostFactory.Run(x => { x.Service(s => …
Mike Chaliy
  • 23,606
  • 16
  • 61
  • 102
9
votes
2 answers

Is it possible to start multiple services from one Console Application by Topshelf?

As TosShelf says: "You can only have ONE service! As of 3.x Topshelf the base product no longer support hosting multiple services. " as of version 3.x I need to figure out how to integrate the new version of Topshelf. Question: Is it possible to…
pencilCake
  • 45,443
  • 73
  • 211
  • 346
1
2 3
22 23