Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 occurred, System.IO.IOException: The operation completed successfully.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.Console.set_Title(String value) at Topshelf.Hosts.ConsoleRunHost.Run()

For those not familiar with Topshelf: http://docs.topshelf-project.com/en/latest/index.html

like image 500
maplemale Avatar asked Feb 17 '16 21:02

maplemale


People also ask

What is a Topshelf service?

Topshelf is a Windows service framework for the . NET platform. Topshelf makes it easy to create a Windows service, test the service, debug the service, and ultimately install it into the Windows Service Control Manager (SCM).

What is Topshelf in c#?

Topshelf is a framework for hosting services written using the . NET framework. The creation of services is simplified, allowing developers to create a simple console application that can be installed as a service using Topshelf.

How do I debug a Windows service in Visual Studio?

Start Visual Studio with administrative credentials so you can attach to system processes. (Optional) On the Visual Studio menu bar, choose Tools, Options. In the Options dialog box, choose Debugging, Symbols, select the Microsoft Symbol Servers check box, and then choose the OK button.


1 Answers

Appears Topshelf expects the output type be set to "Console Application."

Project Properties/Application/Output Type: Console Application.

I guess I missed the key concept which is to create a console application which enables you to install it as a windows service.

like image 144
maplemale Avatar answered Sep 20 '22 17:09

maplemale