Web app not responding on localhost:5000 when run standalone - asp.net-core

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.

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

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

Related

How to host a Blazor ServerSide app on a VPS

I'm experimenting with the Blazor Server App and want to host it on my own VPS. I followed about every official documentation there is, but I can't get it to work.
VPS info:
Runs on Hostinger -> Ubuntu 18.04 64bit with Webmin
Installed all required dotnet versions on VPS:
When creating a test index.html and place it inside var\www\html\ it can be accessed through a browser and the content is shown
Blazor Server App info:
Start a new project > Blazor Server App > Publish > Local folder
Copy files from bin\release\netcoreapp3.1\publish* into VPS\var\www\html\
The files can be seen when browsing, but nothing executes
What am I missing here? How can what I want to do be done?
I was expecting the application to run, just like it did when executing it in Visual Studio.
I followed this tutorial based on a similar question
https://www.jeremymorgan.com/blog/linux/blazor-in-linux/, but I'm not using CentOS so it did not help much.

Quarkus app runs perfectly on local but does not respond to any request on windows server

I have a simple quarkus api app. I've tested the app on my local machine and its running fine. But when i try to run the same app in windows server it starts perfect but does not respond to any of my api request. It is not showing any error or problems. I've tried multiple ways to run the app also through package and jar files but all led to same result. screenshot of the palce where app gets stuck

debugging chrome remotely - doesn't open websocket

Im running chrome headless through chromedriver and selenium via python.
I've run into the following issue both on Mac and Linux.
Im starting chrome as follows:
if self.headless:
options.headless = True
options.add_argument("--headless")
if self.debug_port:
logging.info(f"Setting up remote debugging on port {self.debug_port}")
options.add_argument(f"--remote-debugging-port={self.debug_port}")
options.add_argument(f"--remote-debugging-address=0.0.0.0")
If I connect to http://localhost:9222 from another headed instance of chrome I can see the list of sessions and connect to it seamlessly. At which point i have a window opened up with a screencast of the remote session and the dev console.
Here's that successful example:
When I connect to http://192.168.1.194:9222 I get the list of sessions just fine and upon selecting one the dev console opens but it doesn't start the websocket connection to ws://192.168.1.194 so the screencast and remote debugging capabilities are not available.
Here's that failed example:
I've captured har files and uploaded them here if you want to take a look
Using the following steps I was able to debug remotely. However the screencast functionality did not work. Ultimately that's what I needed so this is only a 50% solution in my case.
So, as noted above in the comments, what's blocking remote debugging from working is that the chrome debugger links out to https://chrome-devtools-frontend.appspot.com/..... and passes a value of ws://192.168.1.194 for the websocket parameter. Any browser will inherently block this, based on it being mixed content - i.e: https + ws
What's needed here is to run the chrome dev tools frontend on a http server
and direct your chrome instance to that server instead of the appspot instance.
Solution Steps
1 Install depot_tools (pre-requisite for building)
https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
2 Checkout the devtools-frontend repo
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#checking-out-source
3 Build chrome devtools frontend
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#build
4 Start the devtools-frontend http server
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#running-in-hosted-mode
5 Run 2 instances of chrome and use one to debug the other
5.1 Start first instance of chrome headless
...with remote debugging enabled. See the python way in the question above or do it from the command line with the same arguments
5.2 Start a second instance of chrome
...using a different user data dir --user-data-dir=<some-path>
5.3 Navigate to http://192.168.1.194:9222
Use whatever the IP address of the first chrome instance is and the port that you chose.
5.4 Create a link to the local dev server
The 2nd instance of chrome will now be showing you links to debug each of the open tabs of the 1st instance. However the links will still to go https://chrome-devtools-frontend.appspot.com/..... You'll need to copy n paste the link you want and replace the hostname with the hostname of the devtools frontend that you started in step 4
Walla!!
If you figure out how to get the screencast working please comment below! 🙏
N.B:
I also tried using the npm run server command in the devtools frontend but for some reason that server didn't work at all ¯\_(ツ)_/¯

Locating CLI error logs when deploying an ASP.NET MVC5 app using web deploy fails

I am trying to deploy an ASP.NET MVC5 web app (web deploy deployment package) on my Windows Server using Command Prompt as I have done countless of times before with the same web app. When I try running the command
myproject.deploy.cmd /t
inside the correct folder the process starts but then abruptly stops and the CLI window closes.
Just before the window disappears I can see an error message in red, but I just do not have enough time to read what it says.
My question is where does one find the logs for commands that have failed? Alternatively is there a way to force the CLI to stay open in order to read the error displayed?
I managed to find the logs in the Event Viewer:
Event Viewer -> Applications and Services -> Microsoft -> Windows -> WebDeploy -> Errors

ASP.NET Core Web Application console closes immediately

I'm trying to run an ASP.NET Core Web Application using its console profile. The console opens and closes immediately so I get ERR_CONNECTION_REFUSED error in browser. Is it possible to find out why the console/host closes? There is nothing in event log and I've enabled stdout but it doesn't produce any output.
Try to start you app from already open console window.
Run cmd, navigate to your project folder and execute dotnet run.
Your app will start and terminate, but console window will remain open and you will see exception (if any) or other output that may help you.