Found the problem: during my debug, I had to define registry key DefaultSecureProtocols in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp
and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp
as described in this topic.
However, I see that this topic applies to a lot of Windows version, but not windows server 2016 (which I'm using).
I've deleted this registry keys and it works now.