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.


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

Popular posts from this blog

Solving Sonarqube :- Project was never analyzed. A regular analysis is required before a branch analysis

spark - pyspark reading from excel files