Powershell New-WebServiceProxy giving underlying connection is closed


When using powershell to invoke a webservice using new-webserviceproxy, you might encounter the following message, 'The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

To solve this, all you gotta do is type the following in Powershell.

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

And then you can go ahead to invoke your web service using something like this

$svc = New-WebServiceProxy -Uri 'https://servername:9091/QuoteManager/QuoteManagerService.svc?wsdl'

That solved the issue for me.


Comments

Michael Sosis said…
thanks a lot! this fixed my problem.

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm