WebApi service down hosted on Azure App Service - azure

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.

Related

Unhealty backend after scaling up App service plan

I have an application gateway running with a web application in a App service plan. The application gateway listens and passes requests to the backend, which is the web app. There is a health probe implemented that works fine.
The web app was reachable fine until I scaled up the Service plan. Suddenly the health probe timed out reaching the backend and I got a 502 bad gateway error in the browser trying to reach the web application. After hours the website suddenly was back and the backend was healthy again. I was under the impression that you could scale up and down the App plan without any noticeable effect on the website, but it seems the gateway was not playing along.
Did I configure something wrong or should this work like I assumed?
I tried to reproduce the same in environment create app service running with application gateway and got a 502 error.
The number of TCP connections allowed by the plan standard while is an older it contains the double make sure while scaling up and down in app service try to remain in same tier so that inbound IP will wait for sometimes and then scale back.
Try to update your default setting in configuration ->General setting-> ARR Affinity Off. Either your application isn't stateful, or the session state is kept on a distant service like a cache or database. And try to Run your application with a minimum of 2-3 instances to prevent from failure.
You can make use of app service diagnostics gives you the right information to more easily
For Reference:
Get started with autoscale in Azure - Azure Monitor| Microsoft
Guide to Running Healthy Apps - Azure App Service
And I got the same error in application gateway as well to avoid the issue
In your virtual network -> service endpoint -> Add endpoint Microsoft.web in default subnet
.

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.

Azure Web app service becomes unavailable for a few hours

My azure web app service suddenly becomes unavailable for a few hours.
The app hosts .net core 3.1 web API.
All the requests are pending for a few minutes and then fail. Restarting the app doesn't help. Stopping and starting again too.
Applications insights don't show those failed requests.
Please help, the app serves a lot of users and requests!
I have run Availability and Performance diagnostics at the time of the crash:
Everything looks just fine except the failed requests.
As suggested earlier , you can debug why the web app went unavailable by running the availability & performance under Diagnose and solve problems in the portal.
You can also refer this Azure documentation to troubleshoot Troubleshoot HTTP errors of "502 bad gateway" and "503 service unavailable" in Azure App Service
if you are still not able to find any insights , why the webapp went unavailable you can open a discussion over Microsoft Q&A or please create a technical support ticker by following the link where technical support team would help you in troubleshooting the issue from platform end.

Azure Web Apps 500 - The request timed out in 4 minutes

We have sitecore CMS (asp.net application) hosted in Azure Web Apps. On web.config the excutiontime has been set to 1 hour and the session and form auth is set to expire in 20minutes.
When I try to install the sitecore update package I keep getting error below within 4 minutes.
<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>
Appreciate if you could help me understand if there any explicit timeout setting on web app that that overwrite my web.config settings? If yes, how do we increase?
I had a look at few thread posts but didn't help:
Azure Web App or App Service: Service calls(web server) times out after nearly 4mins
How To Prevent HttpWebRequest with long response from timing-out Azure Web App
Thanks.

503 Service Unavailable on Azure Cloud App

I have the strange problem, that began near one week ago. I have the site, hosted as a cloud app (a webrole with at least 2 instances running, auto scaling up to 4 max) in Azure. And from time to time when I open it I get 503 Service Unavailable error. But if I will refresh the page, site will open without any errors. QA site at the same time works without any problems. May you know why it's going on? Thanks!
503s in Azure App Services are one of these three:
You've reached the quota for the underlying app service plan (obviously doesn't apply to a premium plan)
You're using deployment slots and hitting a slot that is missing code (if the slots are 50%/50% or something like that it would explain why the 503 is intermittent)
Remote Debugger is preventing port binding of the application. Try disabling Remote Debugging and restarting the app service.

Resources