502 bad gateway on iis 8.0 intermittently using ARR - asp.net

We have two application server having different url which are called as internal url and we have two more servers on where we have implemented ARR rules which are having set of rules for more 7 applications and accessed as public domain.
I am getting "502 bad gateway" again and again but after restarting iis on arr box it starts working.

First, check the iis site error logs and find out what is the sub status code of the error.
To fix 502 error try below things:
refresh the URL in the browser.
clear your browser cache, cookie, and history.
try to Start your browser in Safe Mode.
restart your iis server.
Edit:
Please refer below article for more detail about the troubleshooting:
https://blogs.iis.net/richma/502-3-bad-gateway-the-operation-timed-out-with-iis-application-request-routing-arr
https://learn.microsoft.com/en-us/iis/extensions/troubleshooting-application-request-routing/troubleshooting-502-errors-in-arr

Related

Azure VM IIS HTTP Status Codes Changed

I have a couple Azure VMs behind a Basic Load Balancer with an HTTP URL Health Probe for the Backend Pool. To mark a server down, that URL returns Status Code 503 (Service Unavailable), but when I call that page from those VMs, the Status Code returned is 403. That still has the desired effect, I suppose, of marking the server down - but I dont understand why the code I set has changed.
This is from an ASP.NET web forms application on the VMs. I look at developer tools in the browser, and from my local machine or from a Dev server on our local network, that page returns Status Code 503, but calling that page from the VMs in Azure, the Status Code is 403.
Here's where I set the Status Code in that page:
Response.Clear()
Response.StatusCode = 503
Response.Flush()
I suppose I should mention that my local is a Windows 10 box, and the server VM is Windows Server 2016. Both are running IIS 10. The application is compiled with .NET Framework 4.6.
Here's the dev tools from my localhost:
Here's the dev tools from the server in azure:
Why the change? Anything I can do to stop this behavior?
So today I tried enabling Failed Request Tracing, but either something wasnt set up correctly, or the error was being handled elsewhere, and didnt result in any failed requests being logged.
Since I wasnt getting any failed requests logged, I opened up Process Monitor and could see that immediately after the call to my Health Probe page, I was getting a call to my custom HTTP Error page. That page must have been what was giving the 403 (dont know why, b/c that page works correctly for other HTTP Errors with a friendly error message and logging of the error to my custom error tracking solution).
I was going to change the Status Code to see if there was something special with the 503 that I was setting that was handled differently in IIS, but that got me thinking about how I was setting the status code...
In my research today, I saw this page https://www.leansentry.com/HowTo/AspNet-Response-Flush-Poor-Performance which cautions against using Response.Flush(). The code that I had implemented was in the Page_PreRender method, so there's not really a need to Flush there anyway.
I removed the Response.Flush and of course, my troubles went away.
The Health Probe page no longer triggers an Error from the Azure VM, and therefore, the status code that I get in my client browser is the 503 that I set in code.
So I guess this case is closed. I will need to figure out why the HTTP Error page was throwing a 403 instead of returning the friendly error message, but that should be easy enough...

IIS7 - no response from server on request with DELETE verb

I have a Windows 2008 Server running the default IIS 7.0. I have an http handler where GET, POST, and PUT are working fine, but whenever I issue a DELETE request, there is nothing coming back from the server at all.
I'm using Fiddler to issue the request (which works great on my development Windows 7 machine). I have disabled WebDav, etc., which by the way should have given me some kind of error response anyway. In this case there's nothing. I've tried to enable tracing on the server and don't see anything there either.
I have tried to issue the DELETE web requests on other pages on the server as well, including non-existing ones, but there's never any respone. Maybe something on the server is "eating" the request before it gets to IIS?
To test this last question, I installed Fiddler on the server itself and posted the DELETE request from within the server. This actually worked!!! So, what's stopping the external request then?

IIS7 .NET (2.0, 4.0) completely hosed with a Bad Request (Error Code 400) error

All of a sudden all of my websites on my server return 400 Bad Request Error. I don't have a clue what happened. App Pools are running in Classic pipeline mode (4.0, 2.0), doesn't matter.
Every URL that I type comes back as 400 Bad Request. Real URLs, even fake URLs that don't exist (which should come back as 404) all are 400.
http://mywebsite.com/AFile.aspx
http://mywebsite.com/AFolder/AnotherFile.aspx
http://mywebsite.com/Bfolder/YetAnotherSillyPage.aspx
http://mywebsite.com/A_stupid_URL_that_does_not_even_exist_fjfjffjfj.aspx
Everything 400 Bad Request. Totally screwed up my ASP.NET. Where should I begin to look? Machine.config? Web.config?
UPDATE:
After trying a million different settings, I finally set the App Pool to Integrated and set the Identity to LocalSystem and all of a sudden it works.
Bad Request usually is HTTP.sys stopping the request due to something really bad (like invalid URLs, or something like that).
You probably should look at HTTP.sys logs (Not IIS) at:
C:\Windows\System32\LogFiles\HTTPERR
Also, maybe something got broken in the http.sys configuration so try running:
netsh http show servicestate
And see if for your web site it has the correct bindings, for example it could be that the bindings are only listening on only specific IP Addresses and yet its coming from another one, or similar problem but with Host Name, etc.
Finally you might want to run:
C:\Windows\System32\inetsrv\appcmd list sites
And see if the bindings and status makes sense.
Have you tried some mixture of re-installing (or uninstall/install) asp.net using the aspnet_regiis.exe utility? That's fixed strange IIS/ASP.NET server issues for me in the past.
Have you looked in the event log for any error messages or further clues?

Cannot get ASP.Net to serve any pages under IIS6

I am trying to set up another instance of a live website for a customer to evalulate, however i am unable to get the server to serve up any ASP.NET pages at all.
I know this is normally a bit of a noob question, but i have set up these servers a hundred times and know all the usual gotchas, i have done all of the following to no avail, and for my example i have created a simple test page that writes out hello world, and i'm still unable to get anything to serve..
This is windows server 2003 R2 SPII
I have registered ASP.NET using aspnet_regiis.exe -i
I have enabled the web service extensions
I have created it as a virtual directory, and created the application
I have set the version of ASP.NET for my virtual directory to use
I have even created a new App Pool and given it administrator permissions.
I have run Auth Diag From Microsoft, i get and error from the authentication check, but it is blank
I have given full control to the everyone group for the folder
I have tried creating a new website with a different port, same problem
In fiddler i get the following repsonse when loading an asp.net page :
HTTP/1.1 504 Fiddler - Receive Failure
Content-Type: text/html
Connection: close
Timestamp: 09:43:01:0634
ReadResponse() failed: The server did not return a response for this request.
Looking at the IIS logs, i dont see any entries for any of the ASP.NET requests unless i turn on windows authentication, then i see
2011-04-12 08:13:23 W3SVC1 10.4.3.16 GET /test/Test.aspx - 80 - 10.2.16.17 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+GTB6.6;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+InfoPath.2;+.NET4.0C;+.NET4.0E) - 401 2 2148074254
2011-04-12 08:13:26 W3SVC1 10.4.3.16 GET /test/Test.aspx - 80 - 10.2.16.17 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+GTB6.6;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+InfoPath.2;+.NET4.0C;+.NET4.0E) - 401 1 0
HTML Pages serve up just fine, i'm stumped and about to get the server re-built as i have wasted long enough on this..
Any ideas :( ?
I ended up removing IIS and re-installign it, set the site back up and it worked fine...
Have you checked the windows event log for information that may lead to what is causing this?
You could also try removing the application role and adding it again encase there was an issue when originally setting it up.

CFHTTP and IIS 7 Connection Failture (NOT SSL)

I'm trying to do a very simple CFHTTP GET call to a local website running on IIS7, however it throws a 408 Connection Failure.
I've done all the obvious things:
The site is listed in the hosts file locally
I've added the CFHTTPPARAM tags for IIS compression issues (deflate;q=0)
Surfing to the URL in the browser works fine
Doing a CFHTTP to google.com works fine, no local sites work at all.
When searching on Google there are others that have had this, but no solutions.
Anyone successfully got through this issue?
If you are using a private, or not well known certificate provider you may need to add the public key of the certificate provider to the JRUN keystore.
Here's more info on how to do that:
http://cfmasterblog.com/2008/11/09/adding-a-certificate-to-the-coldfusion-keystore/
You may just need to restart CF if you changed your HOSTS file after CF was started. It caching DNS entries pretty greedily.
It's a bad implementation. Use cfx_http.

Resources