nodejs windows service shows as running but is not responding - node.js

I am using the node-windows module to serve my API as a service on a VM windows server. the service was running fine but after this weekend I had no response from the API and no errors in the app that is calling the API.
When I checked the server the API service is showing as running, I restarted the service and all is good now.
Does anyone know why this is or how can I troubleshoot (get more info ) about what was happening?
Thanks

Related

Why I am not receiving proper logging of the failed request hosted on App Service?

I have web app and web api hosted on Azure App Service. It is a big application that works fine on IIS when hosted locally. When we hosted it on app service it works fine but only few things stopped working. I can't debug a code in App service because whole team is working on it, but when I host Web api in my personal azure account and used postman to debug it then also it works fine. When I check Application insight logging to figure out the issue, I can only see a log made by Web Api, this is the log:
How should I debug the issue in such a case?
When we hosted it on app service it works fine but only few things stopped working.
Make sure you are logging properly all your services in your Web App and Web API. You can check the details information of error in Application insights or in a KUDU console from there you can see the log files from where it has problem.
Using kudu:
https://<YourWebApp Service>.scm.azurewebsites.net/DebugConsole -> Log Files (Check the application logs)
How should I debug the issue in such a case?
The only solution is you can remote debug your application deployed in your App Service. For that you need to enable the remote debugging in your app service.
I can't debug a code in App service because whole team is working on it
If it is in a production environment, you can create a separate slot by MS-DOC and add your Web app and try to debug.

HttpContext.RequestAborted not signalling when services are load-balanced using azure application gateway

We have asp.net core api, that is hosted in docker in azure vm's. And the api is load balanced using azure application gateway.
We are using HttpContext.RequestAborted to cancel any long running processes when the client request is aborted or give-up. It's working when we run the api locally in Visual Studio. But not when it's deployed in to a load balanced environment. We believe it's due to the application gateway not forwarding the cancellations. Is our assumptions correct or anything we need to configure in api/app-gatway to get it working ?
Any help or suggestion would be greatly appreciated. Thanks.

Azure app service startup command (required)

I am deploying my ASP.NET Core 3.1 app to Azure App Service. While creating the new app service, I chose Linux as Operating System. In deployment center, when I deploy the app, it prompts me to enter a startup command. Everywhere I read about it it says startup command is optional. But when I deploy, it doesn't get further without this.
I have recently deployed other app services on windows and this was not the problem then. The startup command I am entering is dotnet <project.dll>. It deploys successfully. But after the deployment whenever I hit an API endpoint, it gives 500 Internal Server Error.
My question is:
What is the purpose of startup command? Why is this returns with 500 when deployed to linux.
S
It seems your startup command is correct refer to this.
You could check if this setting had been set already in Configuration, and check if the .dll file name is correct. As far as I known, this setting is necessary under Linux environment.
For 500 Internal Server Error, it's a error from server side, sometimes it means your web app is not prepared, and restart it would solve the problem.
If not solved, check the wwwroot file structure in kudu. ->.scm.azurewebsites.net If the file structure not correct, try another way to deploy.
Update
As your own reply, you connected your app to database. If issue still here, try add sql server policy like this:
I diagnosed the problem. My deployed app service is not whitelisted to access database. That is the reason for 500 Internal Server Error

WebApi service down hosted on Azure App Service

I hosted a Web Api to azure app service. Everything works fine when I published it.
After a couple of days, the Web Api stops responding. But my app service is still running.
Even added application Insight Logs to all the code, to all the catch blocks, even then its not helpful.No exception was logged to date.
Checked the following, but doesn't seem to be helpful.
Thread Count of app service.
CPU time.
and this was the error when I tried to hit from postman after my web API is down.
<html><head><title>500 - The request timed out.</title></head><body> <font color ="#aa0000"><h2>500 - The request timed out.</h2></font> The web server failed to respond within the specified time.</body></html>
When I restarted my app service the web API started working and stops again after a couple of days.
I think your app service is being idled out due to inactivity . Please set always on to be true in the general settings in configuration blade , you can check out link
App service configuration.

Querying Azure App Service Backend From Localhost

I recently migrated my app backend from azure mobile services to azure app services. I am using the node.js backend with multiple "easy tables" and "easy api's".
After configuring CORS all of my sites that query this backend are up and running properly.
Unfortunately I have not been able to figure out how to query this backend from localhost. I have tried running sites hosted on my local machine that use the exact same code as working sites hosted elsewhere. I have also tried using postman. All of these attempts result in a 400 bad request error.
Edited o be more clear. I have a migrated azure mobile service running on azure. I am attempting to hit that endpoint from localhost. I have tried to hit this endpoint using postman. I have also tried to hit this endpoint using a locally hosted copy of a website that is currently working when not hosted locally. All requests from localhost end up with a 400 error.
I have added https://localhost, localhost:portnumber, https://myIp to the cors page. On the application settings page my MS_CrossDomainWhitelist setting contains [{"host":"localhost"}] (I have also tried without this setting). I have also tried setting MS_SkipVersionCheck to true. What am I missing?

Resources