{"id":19383243,"url":"https://github.com/rebus-org/topper","last_synced_at":"2025-04-23T21:31:37.150Z","repository":{"id":138118127,"uuid":"83642849","full_name":"rebus-org/Topper","owner":"rebus-org","description":":tophat: Simple Windows Service helper (Topshelf-based, Azure Web Job capable)","archived":false,"fork":false,"pushed_at":"2020-08-14T05:31:42.000Z","size":2812,"stargazers_count":28,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T20:11:51.570Z","etag":null,"topics":["hosting","topshelf","windows","windows-service","windows-services"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rebus-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-02T06:27:50.000Z","updated_at":"2024-09-18T22:06:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b1d81b3-aefa-46f6-9877-fc60e10b6baf","html_url":"https://github.com/rebus-org/Topper","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebus-org%2FTopper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebus-org%2FTopper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebus-org%2FTopper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rebus-org%2FTopper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rebus-org","download_url":"https://codeload.github.com/rebus-org/Topper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250517739,"owners_count":21443833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hosting","topshelf","windows","windows-service","windows-services"],"created_at":"2024-11-10T09:25:10.413Z","updated_at":"2025-04-23T21:31:37.135Z","avatar_url":"https://github.com/rebus-org.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Topper\n\n[![install from nuget](https://img.shields.io/nuget/v/Topper.svg?style=flat-square)](https://www.nuget.org/packages/Topper)\n\nGeneric Windows service host - makes an ordinary Console Application hostable in the following scenarios:\n\n* To be F5-debugged locally - on your developer machine\n* To be installed as a Windows Service - on the servers in your basement\n* To be executed as an Azure Web Job - in the cloud!!\n\nBased on Topshelf. Exposes a drastically simplified API, where \"services\" are simply factories that return something `IDisposable`.\n\nTargets .NET Standard 2.0, so you must target either netcoreapp2.0 (or later), or net462 (or later) in your Console Application.\n\n## Getting started\n\nCreate `YourNewAwesomeWindowsService` as a Console Application project targeting AT LEAST .NET 4.6.2 or .NET Core App 2.0.\n\nInclude the NuGet package :package: \n\n    Install-Package Topper -ProjectName YourNewAwesomeWindowsService\n\nand clean up your `Program.cs` so it becomes nice like this: :sunflower: \n\n```csharp\nnamespace YourNewAwesomeWindowsService\n{\n    class Program\n    {\n        static void Main()\n        {\n                \n        }\n    }\n}\n```\nand then you configure Topper by going\n\n```csharp\nvar configuration = new ServiceConfiguration()\n\t.Add(.. function that returns an IDisposable ..)\n\t.Add(.. another function that returns an IDisposable ..);\n\nServiceHost.Run(configuration);\n```\n\nin `Main`, which could look like this:\n\n```csharp\nnamespace YourNewAwesomeWindowsService\n{\n    class Program\n    {\n        static void Main()\n        {\n            var configuration = new ServiceConfiguration()\n                .Add(() =\u003e new MyNewAwesomeService());\n\n            ServiceHost.Run(configuration);                \n        }\n    }\n}\n```\n\n:monkey_face: Easy!\n\nTopper uses LibLog :zap: to log things.  If you want to use Serilog, you probably want to\n\n```psh\nInstall-Package Serilog.Sinks.ColoredConsole -ProjectName YourNewAwesomeWindowsService\n```\n\nand configure the global :earth_africa: logger before starting your service:\n\n```csharp\nnamespace YourNewAwesomeWindowsService\n{\n    class Program\n    {\n        static void Main()\n        {\n            Log.Logger = new LoggerConfiguration()\n                .WriteTo.ColoredConsole()\n                .CreateLogger();\n\n            var configuration = new ServiceConfiguration()\n                .Add(() =\u003e new MyNewAwesomeService());\n\n            ServiceHost.Run(configuration);                \n        }\n    }\n}\n```\n\n\nAnd that is how you use Topper.\n\n## How to run locally?\n\nPress F5 or CTRL+F5 in Visual Studio.\n\nRun the .exe\n\n## How to run as Windows Service?\n\nOpen an elevated command prompt, and run the .exe with the `install` argument, like so:\n\n```dos\nC:\\apps\\YourApp\u003e YourApp.exe install\n```\n\nand then some Windows Service Control :traffic_light: stuff will appear and tell you some details on how it was installed.\n\nYou can remove it again like this:\n\n```dos\nC:\\apps\\YourApp\u003e YourApp.exe uninstall\n```\n\nNot exactly surprising. :clap:\n\n## How to run as Azure Web Job?\n\nJust run it as you would any other Console Application as a Continuous Web Job.\n\nTopper automatically monitors for the presence of the `WEBJOBS_SHUTDOWN_FILE`, to be able to shut down gracefully and dispose your `IDisposable`s. :recycle:\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebus-org%2Ftopper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frebus-org%2Ftopper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frebus-org%2Ftopper/lists"}