DEV Community

Discussion on: Running a .NET application as a service on Linux with Systemd

Collapse
 
ricobrase profile image
Rico Brase

Thank you for your nice post!

Would you mind adding language hints to your code blocks? That enables syntax highlighting which might help reading your code samples. :)


```cs
// your code here
```

You can replace cs with any abbreviation of a file format for proper highlighting. :)

Before:

public class Program
{
    // ...

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .UseSystemd() // add this
            .ConfigureServices((hostContext, services) =>
            {
                services.AddHostedService<Worker>();
            });
}
Enter fullscreen mode Exit fullscreen mode

After:

public class Program
{
    // ...

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .UseSystemd() // add this
            .ConfigureServices((hostContext, services) =>
            {
                services.AddHostedService<Worker>();
            });
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
maartenba profile image
Maarten Balliauw

On it :-)

Collapse
 
ricobrase profile image
Rico Brase

Wonderful, thank you very much!