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

Popular posts from this blog

OpenCover code coverage for .Net Core

ionic2 cordova build android - Unable resolve gradle 2.2.3

Using Custom DLL with IronPython / Scripts