在Windows上的bash上运行Kestrel

时间:2016-08-11 16:11:07

标签: linux bash kestrel-http-server windows-subsystem-for-linux

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

我可以创建和运行控制台应用,但只要我输入

ld

在网络项目上,我得到:

dotnet run 

有人在这方面取得了成功吗?我是否过多地要求"剥离-β-linux版本"?

修改

要重现行为,请在Windows提示符上按b键我输入:

    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)

然后出现问题。

1 个答案:

答案 0 :(得分:2)

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

  

错误-98 EADDRINUSE地址已在使用中

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