English 中文(简体)
Error connecting to secure web service!
原标题:
  • 时间:2009-11-16 17:08:51
  •  标签:
  • c#
  • .net
  • wsdl

I am consistently receiving the following error when trying to create a Web Reference in Visual Studio 2008 to a 3rd party web service.

Received an unexpected EOF or 0 bytes from the transport stream

I get the same error too if I try to generate a proxy class vith the wsdl.exe tool.

I can confirm the web service is operating as it should as I can connect to via 3rd part tools such as the SOAPUi client.

Am I missing somehing simple?


I have since found the following post: http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/37c376a3-f50c-4b57-a1df-83dc43fcddbf

While it describes my issue exactly, I am not sure I understand the solution. Is anyone able to clarify?

最佳回答

In the end I downloaded Visual Studio 2010 trial and it guess what it worked!

Don t ask me why.

问题回答

(From the MSDN Forums referenced above)

Scenario:

Local side: Asp.net 2.0 Web Service, IIS 6.0

Remote side: Java Web Services, Apache, Local ssl certificate(https)

Solution:

In short, the problem was when the web service tried to connect to establish the ssl handshake, by default uses TLS and in this case the java web services was SSLv3, but the error never showed this in plain text.

In order to config this you have set to:

System.Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Ssl3

After this the service will do the hand shake and continue.

Too old, but in case someone else is struggling, here is another try that worked for me in legacy code:

System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;

This is TLS 1.2, but the value does not exist in the enumeration in .NET 2.0.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签