I have ASP.NET Core Web API deployed as App Service on Azure. App Service is set up to require Client Certificate. Also AlwaysOn for App Service is set to True.
Issue is that first request with small payload sent to Web API takes approximately 2-3 seconds, and with large payload timed out. But after first small successful request, next one with large payload executes in less than a second. After some period of inactivity the issue occurs again, and first request to Web API again either takes time or timed out.
When Require Incoming Certificate is disabled, no issues with first request execution time, it executes quite fast always.
Web apps are unloaded if they are idle for a set period of time.
Quoted from official docs:
The downside is that the response to the first request after the web app is unloaded is longer, to allow the web app to load and start serving responses.
If you're using a Basic and Standard service plan, you can turn on the Always On setting to keep the app always loaded:
In the Azure portal, go to your web app.
Select Application settings.
For Always On, select On.
Related
We have a problem with an application hosted on Azure App Service Plan version P3V2. Depending on the traffic in our system, the App Service Plan is scaled up to 5 instances. During heavy traffic, one of the application instances stops responding to requests and after a few minutes it is restarted by the Auto Heal functions. We use Application Insights to monitor the application, unfortunately no logs are saved when there is a problem with the operation of this one instance, also in Event Log we do not see any logs that can help us.
Below I am sending a screen from last week showing all the situations when one of the instances stopped responding to requests.
We did not notice any jumps in the memory used in the application as well as the increased processor time.
I would be grateful for any suggestions or tips.
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.
I have a published .NET Core 2.0 API in production hosted through IIS.
This API has a hangfire dashboard and a single recurring job running through it.
This API exposes a service layer to us developers for jobs that we need to perform on certain databases so it is not always being hit with traffic - perhaps only occasionally when a dev hits an endpoint. The Recurring job runs hourly.
My Problem: Once the site receives no traffic for a while IIS idles the app effectively killing my hangfire job - I know this because in the dashboard when I click servers it says 0. As soon as I hit an endpoint on the API it spins back up.
What I've tried so far: In IIS Set startmode to AlwaysRunning and set the idle timeout to 0 for that specific application pool.
I know this is not working because every morning when I come into the office I check Kibana for logs that should be constant throughout the night due to the recurring hourly job but unfortunately nothing happens. As soon as I hit the API everything starts working again and the job queues.
I am using an api which takes more time to give response. If I tested the web api that was deployed in IIS from postman, It works without any time out. If I tested the same api that was deployed in azure, It gave me timeout.
Somewhere I read that you need to set the timeout in client application. I used postman in both cases. I verified the timeout for postman. It is infinity.
Can you give me the solution?
I think that you hit the default timeout of Azure Web Apps (i think it is 3 minutes, if i remember correctly). Could you set SCM_COMMAND_IDLE_TIMEOUT from the portal - web app settings => app settings => add the setting with the needed value (to say 360 (in seconds)). Reference.
I have a Web site deployed on Azure Web App. My web site gets very slow at times. This behavior is random.
On checking IIS Logs during the period of slowness, I found few requests coming in where the Client IP Address is blank (It shows "-").
The response time of these requests runs into minutes and finally they result into HTTP 500 error. This happens only for the requests where c-ip is blank.
All other requests that have a Client-IP address are processed successfully. But because of the bad requests my application becomes very slow. I have to restart my Web App to resolve this issue.
What could be the possible reason behind these requests having a blank Client IP Address ? Could this be a malicious attack on the web site ?
Difficult to say. Could you add Application Insights service to your project? It allows you to see what is going on before and after 5 minutes of "this" request. The second reason can be the mode of your Azure Web App - is it free or shared or standard?
After AI added, you could share some more insights, because it is important to know what is that request about, not just the fact that it was processed.
https://azure.microsoft.com/en-us/documentation/articles/app-insights-start-monitoring-app-health-usage/