Skip to content
This repository has been archived by the owner. It is now read-only.

EADDRINUSE address already in use #1035

Closed
fanadd opened this issue Aug 6, 2016 · 9 comments
Closed

EADDRINUSE address already in use #1035

fanadd opened this issue Aug 6, 2016 · 9 comments

Comments

@fanadd
Copy link

@fanadd fanadd commented Aug 6, 2016

Hello Microsoft, I've just tried to launch ASP.NET application sample from official docs using Ubuntu Linux 14.04 subsystem for Windows 10 and came across the following issue with Kestrel:

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 aspnetcoreapp.Program.Main(String[] args)

Here's app sources and some compiled binaries for it:
Bloge.zip

Windows 10 1607 (Build 14393.10)
Linux Ubuntu 14.04.5 LTS

@Tratcher
Copy link
Member

@Tratcher Tratcher commented Aug 6, 2016

The port you tried to listen on was already in use. Did you try another one?

@fanadd
Copy link
Author

@fanadd fanadd commented Aug 6, 2016

Yes. Changing port number using UseUrls() method had no effect on it. Default port number (5000) did't work too.

@cesarblum cesarblum self-assigned this Aug 8, 2016
@cesarblum
Copy link
Contributor

@cesarblum cesarblum commented Aug 8, 2016

I can repro. Investigating.

@cesarblum
Copy link
Contributor

@cesarblum cesarblum commented Aug 8, 2016

@fanadd You're hitting a known issue: microsoft/WSL#68

You can work around it by listening on 127.0.0.1 or [::1] (but not both - fails with the same error).

@cesarblum cesarblum removed the 2 - Working label Aug 8, 2016
@cesarblum cesarblum closed this Aug 8, 2016
@rexebin
Copy link

@rexebin rexebin commented Aug 12, 2016

@CesarBS How do I make the change and listen to 127.0.0.1 please?

@gregorybleiker
Copy link

@gregorybleiker gregorybleiker commented Aug 18, 2016

dotnet run --server.urls http://127.0.0.1:5000

@cesarblum
Copy link
Contributor

@cesarblum cesarblum commented Aug 18, 2016

@rexebin Just pass it to UseUrls when building the host, along with the port you want to bind to:

var host = new WebHostBuilder()
    ...
    .UseUrls("http://127.0.0.1:8080", ...)
    ...
@skorunka
Copy link

@skorunka skorunka commented Sep 16, 2016

Tak a look in Task Explorrer if there is not any other instance of your project running. If so, end it and try again.

@rmit-s3614151-carol-saldanha

Kill all the tasks with .net and Visual Studio and this should work. For Mac users, go to Activity Monitor -> dotnet ->Memory -> Quit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.