NLog does not encrypt the file itself, it just asks the operating system to take care of this. It is exposed in .NET with FileOptions.Encrypted enumeration value. Whose commentary describes well what he is doing:
Indicates that the file is encrypted and can only be decrypted using the same user account that is used for encryption.
"The same user account" is the most typical hang, IIS usually works with its own account, the details are well described in this existing Q + A. The implementation of the operating system is described in detail in this MSDN page .
Using this option on a web server should give a slight pause. The only person who reads the log file easily is an attacker who compromises the machine outside. He has no problems reading the file, its contents are easily accessible in open form, since it uses an IIS account. People who need a log file to stop such an attacker will find it quite difficult to read the file, since they will use their own account to access the machine.
This is not an ideal safety practice.
source share