dotnet / dotnet/AspNetCore.Docs

Add a note about generic host default behaviour when using launchd with default cwd

Open
#36,798 4 comments 0 reactions 1 assignee Claimed by @tdykstra View on GitHub
ai-triage-action-plan
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 2h
Merged PRs (30d)
109

Description

Please see https://github.com/dotnet/runtime/issues/121256

There isn't much we can do in terms of code changes as any change would break a lot of users, however, we can help users understand the situation when they run a generic host based app using launchd without setting the WorkingDirectory in the plist, so they won't have to debug on their own as this situation is difficult to work out in general.

I propose to add these two columns to the very end of the file settings configuration section (https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-9.0#app-settings-file-configuration-appsettingsjson-appsettingsenvironmentjson)

```
Service managers such as SCM, launchd, or systemd may, if not configured correctly, set the application’s working directory to a location outside the directory that contains the configuration files, commonly the root directory on Unix systems or a drive root such as C:/ on Windows. In this case, the file system watcher may end up monitoring a large portion of the filesystem.

This can lead to unintended side effects, including permission errors when accessing files outside the application directory and unnecessary performance overhead due to the number of files being observed. To avoid these issues, it is recommended to configure the hosting environment or service manager to set an appropriate working directory for the application.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.