Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot generate web service reference after upgrading to TLS 1.2

My servers has been recently upgraded to support TLS 1.2 and rest other (TLS 1.0 and TLS 1.1.) has been disabled. Now when I tries to generate the reference it gives me following exception:

service Url = https://server-name/service.asmx

Error: Cannot obtain Metadata from "service url" If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: "service url" Metadata contains a reference that cannot be resolved: "service url". An error occurred while making the HTTP request to "service url" This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. The underlying connection was closed: An unexpected error occurred on a send. Received an unexpected EOF or 0 bytes from the transport stream. HTTP GET Error URI: "service url" There was an error downloading "service url". The underlying connection was closed: An unexpected error occurred on a send. Received an unexpected EOF or 0 bytes from the transport stream.

I tried the solution at following link but didn't worked for me, Kindly help.

support.microsoft.com/kb/888528

like image 586
shakti Avatar asked Feb 03 '15 14:02

shakti


1 Answers

We recently ran into this exact issue, after PCI compliance forced us to blanket-disable SSL3 and TLS 1.0. Ultimately, the best solution we found was the same one that client apps are using to allow connectivity to web services on .NET 4.5+; namely, adding some code to adjust that setting for Visual Studio at runtime. In the most basic form, that looks like this:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

We did this via a VS package with a simple configuration UI, which is available in the visual studio gallery, if you want a drop-in solution:

https://visualstudiogallery.msdn.microsoft.com/63750942-1ebe-45dd-bade-552dd850873e

If you'd rather handle it yourself, all you need to do is create a VSIX package or an Add-In (both of which require the visual studio sdk).

Good luck!

like image 148
Jesse MacNett Avatar answered Nov 15 '22 22:11

Jesse MacNett