ASPX.NET Core - random 502 error on IIS server - asp.net-core

We just launched a site that runs on ASP.NET Core 1.1, Windows 2008R2, IIS 7.5 with all the latest patches to 2008 and asp.net.
The site runs fine, but goes down with no apparent pattern. All of a sudden it would start returning 502 response:
502 – Web server received an invalid response while acting as a gateway or proxy server
Restarting the site in IIS, or recycling site’s application pool brings the site up, but the problem reoccurs within a few hours. As workaround, we configured IIS to recycle app pool every 90 minutes, and that seemed to keep the site up all of the time.
Any recommendations on how to troubleshoot this problem?
Thank you!

IIS says with this 502 error that Kestrel (behind it) returned something "wrong". Enable (more) logging, and inspect logs before first 502 response. Some previous request "breaks" your app.

Related

SignalR Core connections not being closed and bringing down IIS

We have SignalR Core running in IIS and the connections are not being closed over time.
This results in a 503 error:
HTTP Error 503.2 - Service Unavailable
The serverRuntime#appConcurrentRequestLimit setting is being exceeded.
When recycling the apppool the Current Connections will drop to 0 and then back up to around 50 (as actual clients reconnect). Over the course of a day it can easily reach 2000. Not every connection is leaking - the number does decrease but trends upwards over time.
Latest .NET Core 3.1 is installed.
We are using Argo Tunnel which creates a tunnel from our webserver to the Cloudflare network.
Turns out it was an out of date cloudflared executable.
The version we were running was from 5/2019 and updating to the new version from 12/2019 has fixed the problem. In fact when stopping the cloudflare service all the connections instantly dropped away.

why dotnet.exe is terminated under IIS

Introduction
I do have WebApi on.Net Core 1.1 & simple test application executing some scenario with calls to my API in multiple threads. Web API is hosted under IIS on WS 2012 R2.
Problem
When I do start my test application with 20 threads in 20-30s test application begin to receive 401 error from the server. After some investigation, I've noticed that dotnet.exe process is suddenly terminated & restarted on the server on high load.
There is no information neither in my logs nor in Windows event log (only one from IIS AspNetCore Module about starting new process: Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' started process '10248' successfully and is listening on port '23570')
I've tried to reproduce this on my machine without any success - this does not happen when my API is hosted in IIS Express from VS.
Question
What may be the reason?

Azure- domain randomly stop working and gives issue as "The service is unavailable."

We have Hosted our site in Azure ( Azure Website ) and configured trafic manager for load balancing and also configured wildcard subdomain to us Nth number of sudbomain pointed to this site.
From last few days i am facing issue like, Randomly approx 5 times in an hour i got 503 (service not available) error and soon working fine itself.
I have checked azure service status also and its saying all services are normal and running.
can anyone tell me what reason should be possible for this happening. is their any setting in Azure to resolve this OR is this issue of overload.
issue is like
can anyone please help to solve this issue.??

how HTTPS request is handled by IIS server

I am trying to understand the working of HTTP , IIS and sql server.
I am having an IIS 7 server in my environment which is interacting with a sql database server.
The architecture is
Apache ----> IIS -----> SQL server
The Apache is a reverse proxy server which is sending the HTTP request to the IIS server and from there IIS server is interacting with the SQL database connecting by different application pools for different applications.
My query is if some request has been forwarded by the Apache server and it has reached the IIS ; after that, if the network between the Apache and IIS is having any packet drops ;
Will that have any affect to the performance of IIS and database server?
Will there be any long running queries in the worker process of the IIS? Because my concern is what will happen after the queries that has successfully executed in the Database server. But since the network between the IIS and Apache is broken how can they be forwarded further to the Apache and further to the end user.
Will these queries keep on holding the resources till they are forwarded from IIS to Apache? Because they have successfully completed their tasks but because of network issue they are not being forwarded further. Or are such request stacked up somewhere by the IIS to free up the resources for the upcoming requests??
Once a request has reached IIS it will go and do the required actions, and format the reply. It will try to send the reply to the requestor but if the link has gone, it will be unable to. It will then abandon the request. Resources it is holding for that request will be freed.
To get the data it had for you, Apache has to repeat the request.

Restart a WCF service after a server reboot

Is there some mechanism in WCF that can be used to "pre-start / warm-up" WCF services that are hosted in IIS ?
- something like the warm-up scripts for SharePoint sites
I have the situation where servers are re-booted over night and next day there is a long delay while the WCF services spin-up. I can't change the time-out in various applications that use the services, so the first users are reporting errors in the morning when they go to use their applications
This is on Windows 2003 Server and IIS 6.0, so the IIS Application Pool Warm-Up Module, http://www.iis.net/download/applicationwarmup, as that's for IIS 7.5
NOTE: the module seems to have been temporarily withdrawn, see details on ... IIS Forum
I know you will don't like the answer and I think I repeat myself because it is not the first time I'm posting it. The way to warm-up anything in IIS prior to version 7.5 is using scheduled console application to ping your web site / services and warm them up. It is ugly solution but it works, it is easy and I saw it on every project which had to deal with this requirement.
WCF services should be instantly ready when they start. Just make sure the services are set to automatically start when the server boots.
You can use Windows Server AppFabric, it has Auto Stat feature to keep the service always on. But you need to be on IIS 7.5 to install App Fabric.