WebException意外的EOF打开HTTPS网址 [英] WebException unexpected EOF opening HTTPS url

查看:73
本文介绍了WebException意外的EOF打开HTTPS网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试使用.NET WebClient类打开特定的https网址。但是,我一直收到下面发布的错误。在网上进行一些搜索之后,看起来可能的解决方案可能是设置'ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;'
但是这只会导致500内部服务器错误响应。

I am trying to open a specific https url using the .NET WebClient class. However, I keep getting the error as posted below. After some search on the web, it looked like a possible solution could be setting 'ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;' However this only led to a 500 internal server error response.

有谁知道如何解决这个问题(或者其他人遇到同样的问题)?我正在尝试执行以下代码:

Does anyone know how to fix this (or is anyone else experiencing the same problem)? I am trying to execute the following code:

client = new WebClient();

client = new WebClient();

s = client.OpenRead(" https://osiris.utwente.nl/student/OnderwijsCatalogus.do");

s = client.OpenRead("https://osiris.utwente.nl/student/OnderwijsCatalogus.do");

rdr = new StreamReader(s);

rdr = new StreamReader(s);

string c = rdr.ReadToEnd();

string c = rdr.ReadToEnd();

 

谢谢寻求帮助!

-Floris

 

System.Net.WebException:底层连接已关闭:发送时发生意外错误。 ---> System.IO.IOException:从传输流中收到意外的EOF或0字节。

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.

    at System.Net.FixedSizeReader.ReadPacket(Byte [] buffer,Int32 offset,Int32 count)

   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)

    at System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)

   在System.Net.Security.SslState.StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)

    at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)

    at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)

    at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,Byte [] buffer,AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)

    at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

    at System.Net.TlsStream.CallProcessAuthentication(Object state)

   at System.Net.TlsStream.CallProcessAuthentication(Object state)

    at System.Threading.ExecutionContext.runTryCode(Object userData)

   at System.Threading.ExecutionContext.runTryCode(Object userData)

    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code,CleanupCode backoutCode,Object userData)

   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean ignoreSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

    at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)

   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)

    at System.Net.TlsStream.Write(Byte [] buffer,Int32 offset,Int32 size)

   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)

    at System.Net.PooledStream.Write(Byte [] buffer,Int32 offset,Int32 size)

   at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)

    at System.Net.ConnectStream.WriteHeaders(Boolean async)

   at System.Net.ConnectStream.WriteHeaders(Boolean async)

    ---内部异常堆栈跟踪结束---

   --- End of inner exception stack trace ---

   在System.Net.WebClient.OpenRead(Uri地址)

   at System.Net.WebClient.OpenRead(Uri address)

    at System.Net.WebClient.OpenRead(String address)

   at System.Net.WebClient.OpenRead(String address)

    at WebTest.Form1..ctor()

   at WebTest.Form1..ctor()

推荐答案

我转载了你的问题。

I reproduced your problem.


可能你看到了这个解决方案:


这篇关于WebException意外的EOF打开HTTPS网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆