简体   繁体   中英

Error With Asp.NET Core on Linux

I'm trying to follow the steps here to get an ASP.net core running on Ubuntu

https://docs.asp.net/en/latest/getting-started.html

I followed the steps to install .NET core and verified that is running ok.

The ASP app builds without errors, but when I try to run the ASP app, 'dotnet run' the following exception is thrown:

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.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.d__11.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at Sys tem.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)

I've searched around the webz for an a solution, but couldn't find anything.

Any ideas?

Some other program on your system is already using the port the ASP.NET web server is trying to bind to (another dev web server, perhaps). Use the command sudo netstat -ltp to find out what's listening and stop the servers that do, or alternatively, have the ASP.NET web server use another port, using one of the techniques described in the relevant issue on the ASP.NET github , eg by invoking dotnet run --server.urls http://0.0.0.0:1234 .

Turns out, I had to add the .UseUrls("http://*:5000") setting to the Program.cs file.

Error -98 EADDRINUSE address already in use on Ubuntu

Usually this error occurs due to closed the web site and terminated hosting irregularly (missed 'ctrl+c', instead probably with 'ctrl+z'); However, the tcp:{port} still be listening, you've to terminate or kill the process manually by ' kill -9 pid '

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM