gpt4 book ai didi

linux - 在 Windows 上的 bash 上运行 Kestrel

转载 作者:太空狗 更新时间:2023-10-29 12:12:15 25 4
gpt4 key购买 nike

我正在尝试在 Windows 上的 bash 上运行一个简单的网站(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)

有人成功过吗?我是不是对“精简的 Linux 测试版”要求太多了?

编辑:

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

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

然后问题就出现了。

最佳答案

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

Error -98 EADDRINUSE address already in use

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

关于linux - 在 Windows 上的 bash 上运行 Kestrel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38901402/

25 4 0
文章推荐: html - 使用 CSS 使