我的代码上周正在运行,并且刚刚开始在周末失败。不幸的是它来自一个库https://github.com/canton7/RestEase/所以我很难调试正在发生的事情。我这里有网络跟踪日志。
System.Net.Http Verbose: 0 : [12144] HttpClientHandler#64844482::.ctor()
System.Net.Http Verbose: 0 : [12144] Exiting HttpClientHandler#64844482::.ctor()
System.Net.Http Verbose: 0 : [12144] HttpClient#46729429::.ctor(HttpClientHandler#64844482)
System.Net.Http Information: 0 : [12144] Associating HttpClient#46729429 with HttpClientHandler#64844482
System.Net.Http Verbose: 0 : [12144] Exiting HttpClient#46729429::.ctor()
System.Net.Http Verbose: 0 : [12144] HttpClient#46729429::.ctor(HttpClientHandler#64844482)
System.Net.Http Verbose: 0 : [12144] Exiting HttpClient#46729429::.ctor()
System.Net.Http Information: 0 : [12144] HttpClient#46729429 - BaseAddress: ''
System.Net.Http Verbose: 0 : [12144] HttpRequestMessage#41429416::.ctor(Method: GET, Uri: '')
System.Net.Http Verbose: 0 : [12144] Exiting HttpRequestMessage#41429416::.ctor()
System.Net.Http Information: 0 : [12144] HttpRequestMessage#41429416 - Content set to '<null>'.
System.Net.Http Verbose: 0 : [12144] HttpClient#46729429::SendAsync(HttpRequestMessage#41429416: Method: GET, RequestUri: 'https://[redacted]', Version: 1.1, Content: <null>, Headers:
{
Authorization: [redacted]
})
System.Net.Http Verbose: 0 : [12144] HttpClientHandler#64844482::SendAsync(HttpRequestMessage#41429416)
System.Net Verbose: 0 : [12144] HttpWebRequest#37320431::HttpWebRequest(https://[redacted]#1623223772)
System.Net Information: 0 : [12144] Current OS installation type is 'Client'.
System.Net Information: 0 : [12144] RAS supported: True
System.Net Verbose: 0 : [12144] Exiting HttpWebRequest#37320431::HttpWebRequest()
System.Net Verbose: 0 : [12144] HttpWebRequest#37320431::HttpWebRequest(uri: '[redacted]', connectionGroupName: '64844482')
System.Net Verbose: 0 : [12144] Exiting HttpWebRequest#37320431::HttpWebRequest()
System.Net.Http Information: 0 : [12144] Associating HttpRequestMessage#41429416 with HttpWebRequest#37320431
System.Net.Http Verbose: 0 : [12144] Exiting HttpClientHandler#64844482::SendAsync() -> Task`1#13256970
System.Net.Http Verbose: 0 : [12144] Exiting HttpClient#46729429::SendAsync() -> Task`1#13256970
System.Net Verbose: 0 : [10968] HttpWebRequest#37320431::BeginGetResponse()
System.Net Error: 0 : [10968] Can't retrieve proxy settings for Uri 'https://[redacted]'. Error code: 12180.
System.Net Verbose: 0 : [10968] ServicePoint#6044116::ServicePoint([redacted]:443)
System.Net Information: 0 : [10968] Associating HttpWebRequest#37320431 with ServicePoint#6044116
System.Net Information: 0 : [10968] Associating Connection#59817589 with HttpWebRequest#37320431
System.Net.Sockets Verbose: 0 : [10968] Socket#48209832::Socket(AddressFamily#2)
System.Net.Sockets Verbose: 0 : [10968] Exiting Socket#48209832::Socket()
System.Net.Sockets Verbose: 0 : [10968] Socket#5773521::Socket(AddressFamily#23)
System.Net.Sockets Verbose: 0 : [10968] Exiting Socket#5773521::Socket()
System.Net.Sockets Verbose: 0 : [10968] DNS::TryInternalResolve([redacted])
System.Net.Sockets Verbose: 0 : [10968] Socket#48209832::BeginConnectEx()
System.Net.Sockets Verbose: 0 : [10968] Socket#48209832::InternalBind(0.0.0.0:0#0)
System.Net.Sockets Verbose: 0 : [10968] Exiting Socket#48209832::InternalBind()
System.Net.Sockets Verbose: 0 : [10968] Exiting Socket#48209832::BeginConnectEx() -> ConnectOverlappedAsyncResult#54135081
System.Net Verbose: 0 : [10968] Exiting HttpWebRequest#37320431::BeginGetResponse() -> ContextAwareResult#63094882
System.Net.Sockets Verbose: 0 : [14140] Socket#48209832::EndConnect(ConnectOverlappedAsyncResult#54135081)
System.Net.Sockets Information: 0 : [14140] Socket#48209832 - Created connection from 192.168.168.110:52711 to [redacted]:443.
System.Net.Sockets Verbose: 0 : [14140] Exiting Socket#48209832::EndConnect()
System.Net.Sockets Verbose: 0 : [14140] Socket#5773521::Close()
System.Net.Sockets Verbose: 0 : [14140] Socket#5773521::Dispose()
System.Net.Sockets Verbose: 0 : [14140] Exiting Socket#5773521::Close()
System.Net Information: 0 : [14140] Connection#59817589 - Created connection from 192.168.168.110:52711 to [redacted]:443.
System.Net Information: 0 : [14140] TlsStream#12547953::.ctor(host=[redacted], #certs=0)
System.Net Information: 0 : [14140] Associating HttpWebRequest#37320431 with ConnectStream#11429296
System.Net Information: 0 : [14140] HttpWebRequest#37320431 - Request: GET [redacted] HTTP/1.1
System.Net Information: 0 : [14140] ConnectStream#11429296 - Sending headers
{
Authorization: [redacted]
Host: [redacted]
Connection: Keep-Alive
}.
System.Net Information: 0 : [14140] SecureChannel#41622463::.ctor(hostname=[redacted], #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [14140] Enumerating security packages:
System.Net Information: 0 : [14140] Negotiate
System.Net Information: 0 : [14140] NegoExtender
System.Net Information: 0 : [14140] Kerberos
System.Net Information: 0 : [14140] NTLM
System.Net Information: 0 : [14140] TSSSP
System.Net Information: 0 : [14140] pku2u
System.Net Information: 0 : [14140] WDigest
System.Net Information: 0 : [14140] Schannel
System.Net Information: 0 : [14140] Microsoft Unified Security Protocol Provider
System.Net Information: 0 : [14140] Default TLS SSP
System.Net Information: 0 : [14140] CREDSSP
System.Net Information: 0 : [14140] SecureChannel#41622463 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [14140] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Information: 0 : [14140] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = [redacted], inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [14140] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=125, returned code=ContinueNeeded).
System.Net.Sockets Verbose: 0 : [14140] Socket#48209832::BeginSend()
System.Net.Sockets Verbose: 0 : [14140] Exiting Socket#48209832::BeginSend() -> OverlappedAsyncResult#31364015
System.Net.Sockets Verbose: 0 : [15084] Data from Socket#48209832::PostCompletion
System.Net.Sockets Verbose: 0 : [15084] 00000000 : 16 03 01 00 78 01 00 00-74 03 01 59 91 A6 BD 43 : ....x...t..Y...C
System.Net.Sockets Verbose: 0 : [15084] 00000010 : E7 B1 57 E0 2B 0C 69 3B-E9 CB 5C 9A 0C 38 31 B2 : ..W.+.i;..\..81.
System.Net.Sockets Verbose: 0 : [15084] 00000020 : E6 86 C3 EF 88 A2 D2 4C-3D CB E1 00 00 12 C0 0A : .......L=.......
System.Net.Sockets Verbose: 0 : [15084] 00000030 : C0 09 C0 14 C0 13 00 35-00 2F 00 0A 00 05 00 04 : .......5./......
System.Net.Sockets Verbose: 0 : [15084] 00000040 : 01 [redacted] 69 : ...9.........[redacted]
System.Net.Sockets Verbose: 0 : [15084] 00000050 : 2E [redacted] 0A : .[redacted]..
System.Net.Sockets Verbose: 0 : [15084] 00000060 : 00 08 00 06 00 1D 00 17-00 18 00 0B 00 02 01 00 : ................
System.Net.Sockets Verbose: 0 : [15084] 00000070 : 00 23 00 00 00 17 00 00-FF 01 00 01 00 : .#...........
System.Net.Sockets Verbose: 0 : [15084] Socket#48209832::EndSend(OverlappedAsyncResult#31364015)
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#48209832::EndSend() -> Int32#125
System.Net.Sockets Verbose: 0 : [15084] Socket#48209832::BeginReceive()
System.Net.Sockets Error: 0 : [15084] Socket#48209832::UpdateStatusAfterSocketError() - ConnectionReset
System.Net.Sockets Error: 0 : [15084] Exception in Socket#48209832::BeginReceive - An existing connection was forcibly closed by the remote host.
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#48209832::BeginReceive()
System.Net.Sockets Verbose: 0 : [15084] Socket#48209832::Dispose()
System.Net Error: 0 : [15084] Exception in HttpWebRequest#37320431:: - The underlying connection was closed: An unexpected error occurred on a send..
System.Net Information: 0 : [15084] Associating HttpWebRequest#37320431 with ServicePoint#6044116
System.Net Information: 0 : [15084] Associating Connection#12036987 with HttpWebRequest#37320431
System.Net.Sockets Verbose: 0 : [15084] Socket#42715336::Socket(AddressFamily#2)
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#42715336::Socket()
System.Net.Sockets Verbose: 0 : [15084] Socket#36963566::Socket(AddressFamily#23)
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#36963566::Socket()
System.Net.Sockets Verbose: 0 : [15084] Socket#42715336::BeginConnectEx()
System.Net.Sockets Verbose: 0 : [15084] Socket#42715336::InternalBind(0.0.0.0:0#0)
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#42715336::InternalBind()
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#42715336::BeginConnectEx() -> ConnectOverlappedAsyncResult#25474675
System.Net.Sockets Verbose: 0 : [15084] Socket#42715336::EndConnect(ConnectOverlappedAsyncResult#25474675)
System.Net.Sockets Information: 0 : [15084] Socket#42715336 - Created connection from 192.168.168.110:52712 to [redacted]:443.
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#42715336::EndConnect()
System.Net.Sockets Verbose: 0 : [15084] Socket#36963566::Close()
System.Net.Sockets Verbose: 0 : [15084] Socket#36963566::Dispose()
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#36963566::Close()
System.Net Information: 0 : [15084] Connection#12036987 - Created connection from 192.168.168.110:52712 to [redacted]:443.
System.Net Information: 0 : [15084] TlsStream#3038911::.ctor(host=[redacted], #certs=0)
System.Net Information: 0 : [15084] Associating HttpWebRequest#37320431 with ConnectStream#45330878
System.Net Information: 0 : [15084] HttpWebRequest#37320431 - Request: GET [redacted] HTTP/1.1
System.Net Information: 0 : [15084] ConnectStream#45330878 - Sending headers
{
Authorization: [redacted]
Host: [redacted]
Connection: Keep-Alive
}.
System.Net Information: 0 : [15084] SecureChannel#66629781::.ctor(hostname=[redacted], #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [15084] SecureChannel#66629781 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [15084] Using the cached credential handle.
System.Net Information: 0 : [15084] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = [redacted], inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [15084] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=125, returned code=ContinueNeeded).
System.Net.Sockets Verbose: 0 : [15084] Socket#42715336::BeginSend()
System.Net.Sockets Verbose: 0 : [15084] Exiting Socket#42715336::BeginSend() -> OverlappedAsyncResult#49382823
System.Net.Sockets Verbose: 0 : [14140] Data from Socket#42715336::PostCompletion
System.Net.Sockets Verbose: 0 : [14140] 00000000 : 16 03 01 00 78 01 00 00-74 03 01 59 91 A6 BD 86 : ....x...t..Y....
System.Net.Sockets Verbose: 0 : [14140] 00000010 : FA 79 FF 97 CD DB 64 81-EF B7 9F B2 23 6E 8D C0 : .y....d.....#n..
System.Net.Sockets Verbose: 0 : [14140] 00000020 : 7F 3B C5 B5 EB 10 48 EB-FC 7A F6 00 00 12 C0 0A : .;....H..z......
System.Net.Sockets Verbose: 0 : [14140] 00000030 : C0 09 C0 14 C0 13 00 35-00 2F 00 0A 00 05 00 04 : .......5./......
System.Net.Sockets Verbose: 0 : [14140] 00000040 : 01 [redacted] 69 : ...9.........[redacted]
System.Net.Sockets Verbose: 0 : [14140] 00000050 : 2E [redacted] : .[redacted]
System.Net.Sockets Verbose: 0 : [14140] 00000060 : 00 08 00 06 00 1D 00 17-00 18 00 0B 00 02 01 00 : ................
System.Net.Sockets Verbose: 0 : [14140] 00000070 : 00 23 00 00 00 17 00 00-FF 01 00 01 00 : .#...........
System.Net.Sockets Verbose: 0 : [14140] Socket#42715336::EndSend(OverlappedAsyncResult#49382823)
System.Net.Sockets Verbose: 0 : [14140] Exiting Socket#42715336::EndSend() -> Int32#125
System.Net.Sockets Verbose: 0 : [14140] Socket#42715336::BeginReceive()
System.Net.Sockets Error: 0 : [14140] Socket#42715336::UpdateStatusAfterSocketError() - ConnectionReset
System.Net.Sockets Error: 0 : [14140] Exception in Socket#42715336::BeginReceive - An existing connection was forcibly closed by the remote host.
System.Net.Sockets Verbose: 0 : [14140] Exiting Socket#42715336::BeginReceive()
System.Net.Sockets Verbose: 0 : [14140] Socket#42715336::Dispose()
System.Net Error: 0 : [14140] Exception in HttpWebRequest#37320431:: - The underlying connection was closed: An unexpected error occurred on a send..
System.Net Verbose: 0 : [14140] HttpWebRequest#37320431::EndGetResponse()
System.Net Error: 0 : [14140] Exception in HttpWebRequest#37320431::EndGetResponse - The underlying connection was closed: An unexpected error occurred on a send..
System.Net.Http Error: 0 : [14140] Exception in HttpClientHandler#64844482::SendAsync - The underlying connection was closed: An unexpected error occurred on a send..
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
System.Net.Http Error: 0 : [14140] HttpClient#46729429::SendAsync() - An error occurred while sending HttpRequestMessage#41429416. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
--- End of inner exception stack trace ---
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
突出的一点是“剩下0个客户证书可供选择”。我认为这是密钥证书错误,但我该如何解决?我没有添加任何证书或做任何事情来使它最初工作。代码基本上是https://github.com/canton7/RestEase/
中的简单示例答案 0 :(得分:0)
我修正了这个问题:https://github.com/canton7/RestEase/issues/45
我想我已经找到了。我正在使用传统的控制台应用程序。虽然它 已经设置编译为4.5很长一段时间它看起来像 默认SSL设置是遗留的。我通过使用它来实现它 System.Net.ServicePointManager.SecurityProtocol | = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
在初始化RestEase对象之前