aspnetcore: Web API template doesn't run in WSL

From @mfish0005 on Tuesday, June 11, 2019 9:14:26 PM

Web API template won’t run from WSL(Ubuntu) shell

Environment

.NET Core SDK (reflecting any global.json): Version: 2.2.300 Commit: 73efd5bd87

Runtime Environment: OS Name: ubuntu OS Version: 18.04 OS Platform: Linux RID: ubuntu.18.04-x64 Base Path: /usr/share/dotnet/sdk/2.2.300/

Host (useful for support): Version: 2.2.5 Commit: 0a3c9209c0

.NET Core SDKs installed: 2.2.300 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

How to Replicate

Run these commands dotnet new webapi -o ExampleAPI cd ExampleAPI dotnet run

Open browser at localhost:5000 or localhost:5001

Error Details

Browser: “This site can’t provide a secure connection” or not found or NET::ERR_CERT_AUTHORITY_INVALID

Terminal Errors: I run mfish0005@DESKTOP-1QIJO18:/mnt/d/projects/ExampleAPI$ dotnet run I visit localhost:5001 and then this is logged to the terminal:

: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/home/mfish0005/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Development
Content root path: /mnt/d/projects/ExampleAPI
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[14]
      Connection id "0HLNEM2BBOILP" communication error.
System.Net.Sockets.SocketException (22): Invalid argument
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.<GetResult>g__ThrowSocketException|7_0(SocketError e)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.GetResult()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()
info: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[14]
      Connection id "0HLNEM2BBOILQ" communication error.
System.Net.Sockets.SocketException (22): Invalid argument
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.<GetResult>g__ThrowSocketException|7_0(SocketError e)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.GetResult()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()
info: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[14]
      Connection id "0HLNEM2BBOILR" communication error.
System.Net.Sockets.SocketException (22): Invalid argument
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.<GetResult>g__ThrowSocketException|7_0(SocketError e)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.GetResult()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()
info: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[14]
      Connection id "0HLNEM2BBOILS" communication error.
System.Net.Sockets.SocketException (22): Invalid argument
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.<GetResult>g__ThrowSocketException|7_0(SocketError e)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs.GetResult()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()

Summary

This likely seems to be caused by SSL certs. I’m new to netcore and I’ve tried for a whole day to fix it with no luck. I imagine others like me also have this issue. It’s worth noting that dotnet new mvc and dotnet run yields a successful result with no errors.

Copied from original issue: dotnet/core#2852

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Docker is going to be a similar situation.

Docker is handled by the tool and VS. They export the cert from the local machine and map it into the container at the right place.