我试图在Windows上运行一个简单的网站bash(Windows周年更新bash),但我一直没有成功。
我能够创build和运行控制台应用程序,但每当我键入
dotnet run
在一个web项目上,我得到:
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)
有没有人在这方面取得成功? 我是否问太多“精简版beta版本”?
编辑:
要重现这个行为,在windows提示符下input:
mkdir mytestwebsite cd mytestwebsite dotnet new -t web dotnet restore dotnet run
然后出现问题。
该错误消息的重要部分是这样的:
错误-98 EADDRINUSE地址已被使用
这就是说,某些东西已经被绑定到您正在尝试收听的端口上。 例如,如果您尝试运行Kestrel并在端口80(默认HTTP端口)上侦听,则Apache也可能已经连接。 您或者需要关闭已经在该端口上侦听的任何内容,或者更改您的应用以选择新的端口。