Odd Kestrel System.IO.IOException in a blank empty ASP.NET Core project
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
If I create a new fresh ASP.NET core project with the empty template on a fresh Windows 10 as well on my main Windows 10 developer machine.
Don't know if this is related to my issue #26422
I get an exception as shown below in my logs and I have spent hours trying to figure out why I get it, as I thought I did something wrong in my applications. But when I create a new fresh Windows 10 installation in Azure and fresh Visual Studio to verify that it was not my computer, then I gave up and reported this error.
The log below is from a fresh unmodified ASP.NET Core empty project running with Kestrel, the only thing I do is to set the log level to:
```
{
"Logging": {
"LogLevel": {
"Default": "Trace"
}
},
"AllowedHosts": "*"
}
```
If this is by design I wish you could augment the log with the domain or what part of the codes throws this exception,
so its clear why I get it or what the problem is and the domain that is involved.
I suspect it tries to contact some domain with unsupported TLS/SSL level.
When I set
setx DOTNET_CLI_TELEMETRY_OPTOUT 1
Then I don't see any difference.
The log (Running as kestrel) says:
```
dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[2]
Failed to locate the development https certificate at '(null)'.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[0]
Using development certificate: CN=localhost (Thumbprint: 1B0E1FCAE1F8ECA88CE0EE1656782BE95AFF1C7A)
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
dbug: Microsoft.AspNetCore.Hosting.Diagnostics[0]
Loaded hosting startup assembly WebApplication1
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\Edument\source\repos\WebApplication1\WebApplication1
dbug: Microsoft.Extensions.Hosting.Internal.Host[2]
Hosting started
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[6]
Connection id "0HM3D0LVS0OH8" received FIN.
dbug: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HM3D0LVS0OH9" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HM3D0LVS0OH8" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HM3D0LVS0OH8" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[6]
Connection id "0HM3D0LVS0OH9" received FIN.
dbug: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HM3D0LVS0OH9" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
at System.Net.Security.SslStream.<>c.b__69_0(SslServerAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
at System.Net.Security.SslStream.AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.InnerOnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
at System.Net.Security.SslStream.<>c.b__69_0(SslServerAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
at System.Net.Security.SslStream.AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.InnerOnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HM3D0LVS0OH8" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[2]
Connection id "0HM3D0LVS0OH9" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel[39]
Connection id "0HM3D0LVS0OHA" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HM3D0LVS0OH9" sending FIN because: "The Socket transport's send loop completed gracefully."
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HM3D0LVS0OH8" sending FIN because: "The Socket transport's send loop completed gracefully."
dbug: Microsoft.AspNetCore.Server.Kestrel[1]
Connection id "0HM3D0LVS0OHA" started.
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending SETTINGS frame for stream ID 0 with length 18 and flags NONE
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending WINDOW_UPDATE frame for stream ID 0 with length 4 and flags 0x0
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" received SETTINGS frame for stream ID 0 with length 12 and flags NONE
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending SETTINGS frame for stream ID 0 with length 0 and flags ACK
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" received WINDOW_UPDATE frame for stream ID 0 with length 4 and flags 0x0
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" received HEADERS frame for stream ID 1 with length 215 and flags END_STREAM, END_HEADERS
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" received SETTINGS frame for stream ID 0 with length 0 and flags ACK
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 GET https://localhost:5001/
dbug: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[0]
Wildcard detected, all requests with hosts will be allowed.
trce: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[2]
All hosts are allowed.
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1001]
1 candidate(s) found for the request path '/'
dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint '/ HTTP: GET'
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint '/ HTTP: GET'
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending HEADERS frame for stream ID 1 with length 53 and flags END_HEADERS
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending DATA frame for stream ID 1 with length 12 and flags NONE
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint '/ HTTP: GET'
trce: Microsoft.AspNetCore.Server.Kestrel[37]
Connection id "0HM3D0LVS0OHA" sending DATA frame for stream ID 1 with length 0 and flags END_STREAM
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 203.4215ms 200
```
Software used (Visual Studio 16.7.4) and .NET Core 3.1.402
```
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.402\
Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd
.NET Core SDKs installed:
3.1.402 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
```
Contributor guide
Assessment
This issue has not been assessed yet.