# License file information ## License details See the [Licensing page](https://particular.net/licensing) for license specifics. ## License validity The license is valid if the current UTC date has not passed the `ExpirationDate` attribute date value. ### Upgrade protection Some licenses have a date value in the `UpgradeProtectionExpiration` attribute. In this case the license is still valid if the `UpgradeProtectionExpiration` attribute date value is greater than or equal to the release date of the `{major}.{minor}.0` version of the NServiceBus assembly used by the endpoint. To view the release dates for the various versions, see [NServiceBus Packages Versions](/nservicebus/upgrades/all-versions.md). > [!NOTE] > Only the Major/Minor part is relevant; e.g. if using NServiceBus 6.1.1 it's the release date of 6.1.0 that counts. ## Behavior The license is only read once at startup. When the license expires the endpoint logs will contain a message indicating the license is expired. To resolve this the endpoint must be restarted so that it can read the updated license at startup. ### Throughput limitations No technical limitations are enforced at runtime when either no license is found, invalid or corrupt license data is provided, or a license has expired. ## License management There are several options available for installing the license file. > [!NOTE] > Depending on the operating system, the paths may be case sensitive. > > NServiceBus uses the [`Environment.GetFolderPath(SpecialFolder)`](https://learn.microsoft.com/en-us/dotnet/api/system.environment.getfolderpath) method to determine the locations of some paths on each OS. ### Code-first configuration A license can be configured via code-first configuration API: ```cs endpointConfiguration.LicensePath("PathToLicense"); // or endpointConfiguration.License("ContentsOfLicenseFile"); ``` > [!NOTE] > Licenses configured via code-first API take precedence over every other license source. ### Application-specific license location A license located at `{AppDomain.CurrentDomain.BaseDirectory}/license.xml` will be automatically detected. ### User-specific license location To install a license for all endpoints and Particular Service Platform applications run by a specific user, install the license file in the following location: * Windows: `%LOCALAPPDATA%\ParticularSoftware\license.xml` * Linux/macOS: `${XDG_DATA_HOME:-$HOME/.local/share}/ParticularSoftware/license.xml` * macOS (.NET 8): `$HOME/Library/Application Support/ParticularSoftware/license.xml` > [!NOTE] > Ensure that the account under which the endpoint is running has permissions to access the user folder. ### Machine-wide license location To install a license for all endpoints and Particular Service Platform applications on an entire machine, install the license file in the following location: * Windows: `%PROGRAMDATA%\ParticularSoftware\license.xml` * Linux/macOS: `/usr/share/ParticularSoftware/license.xml` ### Environment variable The license can also be specified by setting the `PARTICULARSOFTWARE_LICENSE` environment variable containing the license text. * Windows ```powershell $env:PARTICULARSOFTWARE_LICENSE = @"the license text goes here and is a multiline string"@ ``` * Linux/macOS ```bash export PARTICULARSOFTWARE_LICENSE=`cat ./license.xml` export PARTICULARSOFTWARE_LICENSE="the license text goes here and is a multiline string" ``` Sometimes the license must be embedded in a single line of text, for example, in a command line when deploying an endpoint with Docker. For these scenarios, the license can be minified, removing all spaces and line breaks, by adding `minify=true` to the query string of the URL used to download a license file from the Particular Software website. ### License signature type By default, licenses are signed using `Rsa1024Sha1` (1024-bit RSA with SHA-1). For environments that require stronger cryptographic signing, licenses can be signed using a 4096-bit RSA key pair with SHA-256 instead. A license with the stronger signature can be obtained in one of two ways: 1. [Log in to the customer portal](https://customers.particular.net/) and download the alternative license file format. 2. Add `signature-version=V2` to the query string of the license download URL. > [!WARNING] > RSA 4096 / SHA256 signed licenses are only supported in the following NServiceBus versions: > > - 9.2.12 and higher patches > - 10.0.5 and higher patches > - 10.1.7 and higher patches > - 10.2.6 and all higher versions > > Using an `Rsa4096Sha256` signed license with an older version will cause a license validation failure. ## Troubleshooting Diagnose license scanning issues by [enabling Debug logging](/nservicebus/logging/index.md#built-in-logging-changing-the-defaults-changing-the-logging-level) as all traversed locations and the scan result are logged. ```txt 2020-04-17 12:11:31.979 DEBUG Looking for license in the following locations: License not found in S:\docs.particular.net\samples\pubsub\Core_7\Publisher\bin\Debug\net5.0\license.xml License found in C:\Users\XXX\AppData\Local\ParticularSoftware\license.xml License not found in C:\ProgramData\ParticularSoftware\license.xml Selected active license from C:\Users\XXX\AppData\Local\ParticularSoftware\license.xml License Expiration: 2021-01-01 ``` > [!NOTE] > Identify related log entries by searching/filtering on logger `LicenseManager` or the text `Looking for license in the following locations:`. ### Failed to initialize the license The license management code requires write permissions to store metadata. If the process credentials don't have write permissions the following fatal event log entry can be generated: ```txt FATAL NServiceBus.Features.LicenseReminder Failed to initialize the license System.UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile' is denied. ``` Ensure that the process has write permissions at the specified location. If necessary, either modify the location by using another suitable [license management technique](/nservicebus/licensing/index.md#license-management), change permissions, or use another process that has appropriate permissions.