运行 bash 上的红隼 windows

Run Kestrel on bash on windows

我正在尝试 运行 bash 上 windows 上的一个简单网站(Windows 周年更新 bash),但我一直到目前为止没有成功。

我能够创建和 运行 控制台应用程序,但每当我键入

dotnet run 

在一个网络项目中,我得到:

    Unhandled Exception: System.AggregateException: One or more errors occurred. (Error -98 EADDRINUSE address already in use) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -98 EADDRINUSE address already in use
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.Check(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.GetSockIPEndPoint()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListenerPrimary.CreateListenSocket()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.<StartAsync>d__11.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at WebApplication.Program.Main(String[] args)

有人成功过吗?我是不是要求太多了"stripped-down-beta linux version"?

编辑:

要重现该行为,请在 bash 的 windows 提示符下键入:

mkdir mytestwebsite
cd mytestwebsite
dotnet new -t web
dotnet restore
dotnet run

然后问题就出现了

该错误消息的重要部分是:

Error -98 EADDRINUSE address already in use

这表示某些内容已绑定到您尝试侦听的端口。例如,如果您尝试 运行 Kestrel 并在端口 80(默认 HTTP 端口)上侦听,那么 Apache 也可能已经连接。您要么需要关闭已经在该端口上侦听的任何内容,要么更改您的应用程序以选择一个新端口。