2

I have simple DotNet Core app that runs fine with dotnet run but when I do dotnet publish and then dotnet HelloWorld.dll (in the bin/Debug/netcoreapp1.1 directory; same with bin/Rebug/netcoreapp1.1), on my local machine, the command prompt says "Now listening on: http://localhost:5000" but the service is not responding when I navigate to that address with my browser. Are there any kind of logs to review?

I reproduce the same in Windows 10 and OSX 10.11, both with clean dotnet new -t web projects, without any modifications. In Windows I ran netstat -noa | find "LISTENING" and can see port 5000 at the bottom of the list. But still no connection when I try.

Ideas?

The browser output is:

The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500"

I run .Net Core 1.1.0 - SDK 1.0.0 Preview 2.1-003177 on both the Windows and Mac machine.

matpe
  • 284
  • 4
  • 13
  • You have to provide more information. Console output, exceptions, http response? We have no idea what you are getting? If you get http code 500 its some exception during the execution – Tseng Dec 18 '16 at 22:31
  • 1
    Good point, sorry for not providing enough information. Chrome givs me the following output: "The localhost page isn’t working localhost is currently unable to handle this request. HTTP ERROR 500" I'm expecting to find more information in an error log of some kind, but don't know where to look. – matpe Dec 19 '16 at 06:00
  • Did you figure it out yet? I'm having a similar issue, though perhaps not quite the same. It works fine if I launch the browser on the same machine, but if I try to connect from another machine it doesn't work. I added an inbound firewall rule to allow port 5000 through, but the app doesn't respond at all - like it never sees the request. It just remains at "Ctrl-C to shut down" in the console. I can see the request come in on netmon, but ASP.NET Core remains silent. Perplexing. – Steve In CO Dec 24 '16 at 17:21
  • 1
    Oh, I figured my issue out...maybe this will help you. What pointed me in the right direction was in this question: http://stackoverflow.com/questions/37365277/how-to-specify-the-port-an-asp-net-core-application-is-hosted-on. I added the UseUrls, but it didn't work until I used a public hostname instead of localhost. Seems localhost means only requests from the local machine. – Steve In CO Dec 24 '16 at 18:42

2 Answers2

1

Click on the ^ icon of your toolbar to see hidden icons. If IIS is running, you will be able to see each instance and the port that the instance is listening on

  • 1
    Hi, Dan. I don't see IIS running at all and I don't expect it to. When starting a DotNet Core web app standalone I assume it uses a bundled light weight web server, like Kestrel. The process id returned from netstat (on my Windows machine) turns out to be "dotnet", when I check the Task Manager. – matpe Dec 19 '16 at 06:11
1

I got the same error. To diagnose the error, I started up the app not in IIS Express but in what I think is a self-hosted option that opens in a console window.

If you look through the log in the console window, you might see an error in that log.

enter image description here

Also, I've noticed that sometimes the browser window pops up and navigates to the URL before the host environment is ready to handle the request. All you have to do when you get this error is wait a second and refresh the page, and the host environment will be ready and the page will load.

Trevor
  • 4,620
  • 2
  • 28
  • 37