gpt4 book ai didi

c# - 红隼错误 : address already in use (dotnet core)

转载 作者:IT王子 更新时间:2023-10-29 00:25:40 26 4
gpt4 key购买 nike

总结:它作为 dotnet run 工作,但它不作为 dotnet myappname.dll 工作。

我的 Linux 技能有限,但我正在努力按照书本进行操作,以免混淆(遵循来自 Scott Hanselman 的 this tutorial):

$ cd /home/myusername/dotnettest
$ dotnet run

Now listening on: http://localhost:5123

然后我将它移动到/var,如下所示:

$ sudo cp -a /home/myusername/dotnettest/bin/Debug/netcoreapp1.1/publish /var/dotnettest

最后我测试它是否也在那里工作:

$ dotnet dotnettest.dll

然后它失败了:

info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
User profile is available. Using '/home/myusername/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.

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.TcpListener.CreateListenSocket()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state)
--- 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) in /home/myusername/dotnettest/Program.cs:line 27
Aborted (core dumped)

我一直很小心地试图阻止 nginx。

我已经检查过是否有任何东西正在使用以下命令监听 :5123:

$ lsof -i tcp:5123

似乎什么也没有发生。

最佳答案

以下命令有助于找到端口并杀死进程

mac 上的终端

查找进程号

lsof -i: <port number>

例如 lsof -i:5001

然后杀掉进程号

kill -9 <process number>

例如 - kill -9 1600

关于c# - 红隼错误 : address already in use (dotnet core),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41653805/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com