New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EADDRINUSE address already in use #1035

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

Comments

Projects
None yet
7 participants
@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

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Aug 6, 2016

Member

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

Member

Tratcher commented Aug 6, 2016

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

@fanadd

This comment has been minimized.

Show comment
Hide comment
@fanadd

fanadd Aug 6, 2016

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

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.

@cesarbs cesarbs self-assigned this Aug 8, 2016

@cesarbs cesarbs added the 2 - Working label Aug 8, 2016

@cesarbs

This comment has been minimized.

Show comment
Hide comment
@cesarbs

cesarbs Aug 8, 2016

Contributor

I can repro. Investigating.

Contributor

cesarbs commented Aug 8, 2016

I can repro. Investigating.

@cesarbs

This comment has been minimized.

Show comment
Hide comment
@cesarbs

cesarbs Aug 8, 2016

Contributor

@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).

Contributor

cesarbs 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).

@rexebin

This comment has been minimized.

Show comment
Hide comment
@rexebin

rexebin Aug 12, 2016

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

rexebin commented Aug 12, 2016

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

@gregorybleiker

This comment has been minimized.

Show comment
Hide comment
@gregorybleiker

gregorybleiker commented Aug 18, 2016

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

@cesarbs

This comment has been minimized.

Show comment
Hide comment
@cesarbs

cesarbs Aug 18, 2016

Contributor

@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", ...)
    ...
Contributor

cesarbs 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

This comment has been minimized.

Show comment
Hide comment
@skorunka

skorunka 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.

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

This comment has been minimized.

Show comment
Hide comment
@rmit-s3614151-carol-saldanha

rmit-s3614151-carol-saldanha May 19, 2018

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

rmit-s3614151-carol-saldanha commented May 19, 2018

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 join this conversation on GitHub. Already have an account? Sign in to comment