Error 520 on asp.net web app in production - c#

Our asp.net web app is returning Error 520 on a page in production though no error in development.
This particular error skips our custom error page and present a different error page with Cloudflare.
As in this image
When you inspect the page, you see
"Error: Promised response from onMessage listener went out of scope"
in console
No error is logged by our logging tools, and we cannot tell why it's skipping our custom error page.
Any direction as to how to solve this?

Related

Why specific response codes are being replaced by 500 Internal Server Error in Production environment?

In my .Net Core 2.2 application, I have a WebAPI controller that may return response codes 400 and 409.
In the development environment, I can see those codes along with the error messages. But when I deploy the application to the production environment (a virtual machine in Azure) I see just 500 errors without any details. Can anybody explain how to force IIS to return the initially sent error responds?
I return the error responds with the code like the following:
return StatusCode((int)HttpStatusCode.BadRequest, new { Message = errorMessage });
Finally, I have turned on the Failed requests tracing and it gave me a clue. The cause was in the fact that the same MIME type was configured twice, one time globally at the IIS level, and the second time at the website level. Once I removed the problematic MIME-type from the website configuration all started working correctly.
If someone have the same problem, I solved in the Error Pages area from IIS configuration. When I tried to click, I received a error with the path of web.config from another project. When I solved this error from web.config, the Error Page open correctly and everything work again.

Javascript alert error on a load-balanced environment

We have 3 servers in a DMZ that serve our student web portal. We've been seeing this error:
The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '</div>
</div>
</div>
after clicking next page on a grid pager. On inspecting element, this is the code that gets executed: __doPostBack('pg0$V$1','')". Now, this works as it should if I go into the individual servers and click next page on this table but throws the error above when behind the f5 load-balancer. We have no clue why this is happening. One speculation is since we do inline http to https, that could be a potential issue. We have no control over the ASP.NET code since it's provided by a third-party but the ASP.NET code doesn't seem to be the issue here since it works on the individual servers.

Custom error pages

I have configured the HttpErrors section in my web.config.
My custom error page is shown, but not when an exception occurs outside a web request (eg: Application startup, module initializing...), I get the following error:
The page cannot be displayed because an internal server error has occurred.
How can I make sure that my custom error page is ALWAYS shown?
You can't. The customer error pages are being configured at the start of the ASP.NET application, which fails in your case. There is no ASP.NET pipeline to handle the error pages.
Usually there is not much to do, besides making a proxy that filters out HTTP 500 error messages and replaces it with another message.

Asp.net WebAPI HTTP SERVER ERRORS - user breaks the connection

I have a Web.Api project, and I deployed it to Azure Web Sites.
Some times I see many HTTP SERVER ERRORS in dashboard.
Detailed Error Information: Module ManagedPipelineHandler
Notification ExecuteRequestHandler
Handler System.Web.Http.WebHost.HttpControllerHandler Error
Code 0x800703e3 Requested
URL http://test-server:80/api/Statistics/ShowStories Physical
Path D:\home\site\wwwroot\api\Statistics\ShowStories Logon
Method Anonymous Logon User Anonymous
I don't know how to fix it and why it happens.
UPDATE
I found what this happens because user breaks the internet connections, and my question in next: how to catch this problems, maybe create some custom exception handler, and logger this problems, what this 'http server errors' and not show to Azure dashboard?
See this question: ASP.NET Web API OperationCanceledException when browser cancels the request
I think that if you handle OperationCanceledException correctly, the error will not be logged.

Does ASP.NET Custom Errors override the actual HTTP response code?

If I were to specify a page for redirect using the ASP.NET Custom Errors feature, would my application still spit out the HTTP status code for that particular error?
For example if had a line in my web.config that had all Internal Server Errors redirect to Errors/500.aspx and then I encountered a 500 error, I would then be redirected to my custom Errors/500.aspx page. Will my application still respond with a HTTP 500 at any point in this exchange?
I'm just curious...
No, because your browser would interpret that 500 response as an error and show you it's error. Instead, it probably responds with one of the redirect status codes to send you to the defined error page.

Categories

Resources