I'm trying to set the SSL Mode in my connection string:
SSL Mode=preferred;
But I'm getting an ArgumentException when my code tries to connect to the database:

Notice that the InnerException, says:
Requested value 'preferred' was not found.
Looking at the following documentation, it should be valid to specify required, disabled or preferred:
I'm using Npgsql 3.0.3, which I obtained using NuGet:

So it turns out that you actually need to specify verb values rather than adjectives:
DisablePreferRequireFor example:
SSL Mode=Prefer;
Edit: the documentation has since been corrected.
Add sslmode=Require; and Trust Server Certificate=true; as it is in your connection string.It will work for sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With