I'd like to download content from https://localhost:3000/ using WebClient.DownloadString method, but this call ends up with SocketException: No connection could be made because the target machine actively refused it although the address is reachable via browser.
I figured out, that request is successful when I replace with 127.0.0.1 (so the address is https://127.0.0.1:3000).
How can I fix it so that I can use localhost address (it needs to be localhost due to SSL certificate)?
WebClient was translating localhost address to IPv6 address ::1 and I was not aware of that. So I added new line to hosts file ::1 localhost and change server listen address to the ::1.
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