Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Creating .NET Core web app that includes 'web' or 'app' in the name silently fails to launch in VS (it just hangs on launch) #176

Closed
Tratcher opened this issue May 16, 2016 · 29 comments

Comments

@Tratcher
Copy link
Member

Tratcher commented May 16, 2016

From @BillHiebert on May 10, 2016 23:51

Create a new Empty .NET Core Web app in VS
Call it "web"

Hit F5 (to launch under IIS Express)

Actual:
It fails to launch (spinning Edge icon waiting for it to load) - there are not even an IIS Express logs to debug the issue

What's happening is kestrel is throwing the following exception. It only repros with projects named "web" and when hosted in iisexpress.

Unhandled Exception: System.AggregateException: One or more errors occurred. (Error -4092 EACCES permission denied) ---> Microsoft.AspNetCore.Server.Kestrel.Networking.UvException: Error -4092 EACCES permission denied

at Microsoft.AspNetCore.Server.Kestrel.Networking.Libuv.Check(Int32 statusCode)
at Microsoft.AspNetCore.Server.Kestrel.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags)
at Microsoft.AspNetCore.Server.Kestrel.Networking.UvTcpHandle.Bind(ServerAddress address)
at Microsoft.AspNetCore.Server.Kestrel.Http.TcpListenerPrimary.CreateListenSocket()
at Microsoft.AspNetCore.Server.Kestrel.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.Http.ListenerPrimary.<StartAsync>d__9.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.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 web.Program.Main(String[] args)

Copied from original issue: aspnet/KestrelHttpServer#824

@Tratcher
Copy link
Member Author

From @benaadams on May 10, 2016 23:54

The error means the port Kestrel is trying to listen on already has something listening on it

@Tratcher
Copy link
Member Author

From @halter73 on May 11, 2016 0:3

@benaadams Agreed that that is the most likely explanation. @CesarBS Said he was able to repro and that he would debug it.

@Tratcher
Copy link
Member Author

From @CesarBS on May 11, 2016 0:47

@benaadams I'm not sure. When you try to listen on a port that's already in use you normally get an EADDRINUSE.

@Tratcher
Copy link
Member Author

From @CesarBS on May 16, 2016 19:1

Interesting find here. Look what happens to the address Kestrel tries to bind to when the project is named "web":

image

Compare to any other project:

image

Looks like the issue is coming from ANCM. cc @pan-wang

@Tratcher
Copy link
Member Author

From @CesarBS on May 16, 2016 19:1

cc @Tratcher

@Tratcher
Copy link
Member Author

Specifically, the ASPNETCORE_APPL_PATH is set to ROOT/WEBHOST/WEB for some reason. Is WEB a reserved site name in IIS/Express?

@muratg
Copy link
Contributor

muratg commented May 18, 2016

@pan-wang Is web a reserved name in IIS/ANCM?

@sovaska
Copy link

sovaska commented May 19, 2016

Facing same problem when project name includes "Web", in my case project name is Transfer.Web

@Morcatko
Copy link

I have a Project.WebSite and it works fine. Can be repro only when it ends with Web?

@kspearrin
Copy link

Renamed my project to Web2 and it works fine now.

@muratg muratg added this to the 1.0.0 milestone May 19, 2016
@BillHiebert
Copy link

It does seem to be related to ANCM or Kestrel. I can create and run an MVC5\Webform application with the name web.

@pan-wang
Copy link
Contributor

I don't think Web is a reserved keyword in either IIS and IISExpress. Will look at it.

@lruckman
Copy link

Can confirm creating a new project in RC2 (net461) and naming it Web causes this in VS. Was not the case in RC1. This happen in both brand new projects and those converted from RC1.

@shirhatti shirhatti changed the title Creating .NET Core empty web app called 'web' silently fails to launch in VS (it just hangs on launch) Creating .NET Core web app that includes 'web' or 'app' silently fails to launch in VS (it just hangs on launch) May 23, 2016
@shirhatti shirhatti changed the title Creating .NET Core web app that includes 'web' or 'app' silently fails to launch in VS (it just hangs on launch) Creating .NET Core web app that includes 'web' or 'app' in the name silently fails to launch in VS (it just hangs on launch) May 23, 2016
@pan-wang
Copy link
Contributor

this is bug in ANCM. When resolving the site path, it simply takes the sub string from the app path using the site name and did not consider the app path may already contains string as 'WebRoot' and "AppHost". Will fix it.

@Tratcher
Copy link
Member Author

Root cause: ANCM had a bad IndexOf on the string Machine\WebRoot\AppHost\<sitename>\<appname>\.... Any project who's name is a subset of those values will get the wrong PathBase and crash Kestrel on launch. E.g. Web, App, Host, Machine, Root, etc..

@DreamingDevs
Copy link

My project was named CarSolution.Identity.Web and I am also facing the same problem. So having web might be the problem?

@road42
Copy link

road42 commented May 26, 2016

As you see in #193 it also fails when the url is something like "http://app.whatever.tld/SaveProjectNameHere"

@Tratcher
Copy link
Member Author

@road42 That was because you set your root site name to APP. The url didn't matter.

@road42
Copy link

road42 commented May 26, 2016

@Tratcher Ah sorry this wasn't clear enough. Thank you.

@martincostello
Copy link

I've just come across this issue when deploying an update to a site running RC2 (which was already RC2) when accessing it at http://{name}.azurewebsites.net/. Is this falling foul of the same issue because of the web in azurewebsites?

@Tratcher
Copy link
Member Author

@martincostello I don't think so, it has worked for others on azurewebsites.net.

@martincostello
Copy link

@Tratcher I've been playing around with this, and I think I've actually narrowed it down to there being RC1 and RC2 bits in the same wwwroot folder after the "delete existing files" option wasn't used when publishing the site. However, I've no idea what change triggered it suddenly making a difference. Deleting every file in wwwroot in Azure, re-publishing and restarting the site fixed the problem with the site not starting.

@muratg muratg assigned Tratcher and unassigned pan-wang Jun 7, 2016
@cherici-simone
Copy link

I migrate a solution from RC1 to RC2 and one of the projects was named "Web". I rename it (both name and folder) but I'm still get the same error. Are there "strange" steps to rename a projects?

@muratg
Copy link
Contributor

muratg commented Jun 15, 2016

@cherici-simone what was the new name?

@Tratcher
Copy link
Member Author

@cherici-simone was the error on IIS, Express, or Azure? In Express the project name is used. In IIS and Azure it's the site name.

@cherici-simone
Copy link

I try "Site" but nothing...then I try..."aaa" but the error persist. I try
with a new project and perform the same rename without success. I also
change folders, namespace, launchSettings.json and also rename the solution

On Wed, Jun 15, 2016 at 5:50 PM, Murat Girgin [email protected]
wrote:

@cherici-simone https://github.com/cherici-simone what was the new name?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#176 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AG9pOmtsW7QJqzZTPYjA8mk-Iz08SF47ks5qMB9AgaJpZM4Ifmw9
.

Simone Cherici

@martincostello
Copy link

@cherici-simone Is this in Azure? I had issues with a RC1 -> RC2 migration in Azure because there were things left in the site folder for RC1 that created strange conflicting behaviour. Deleting the RC1 remnants via FTP fixed it.

@Gabee01
Copy link

Gabee01 commented Aug 18, 2017

In my case, changing the port I was using fixed it.. maybe that port was already busy

jkotalik pushed a commit that referenced this issue Dec 8, 2017
Cleans up IIS initialization testing framework
@M-Yankov
Copy link

M-Yankov commented Jan 9, 2018

Thanks for the comments.
For anyone who has the same issue, check whether you are hosting an application on the same port in IIS.
That solved my problem.

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

No branches or pull requests