Monday, March 26, 2012

PageRequestManagerServerErrorException, status code 504

I got the following error message on my ASP.NET AJAX web app:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 504

What does it mean?Huh?

Hi monkeyno,

10.5.5 504 Gateway Timeout

The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.

 Note: Note to implementors: some deployed proxies are known to return 400 or 500 when DNS lookups time out.

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

You get the Sys.WebForms.PageRequestManagerServerErrorException whenever the aspx handler throws an exception responding to an ajax.net update panel submit. If you took away the update panels you would see the classic asp.net exception page with lots of potentially useful information like the stack trace, but since the form submit has been ajaxified you just get a generic error message through a javascript alert. For example create an aspx page with an update panel containing a button and a multiline text control with the text set to "".

monkeyno:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.

Clicking on the button you'll get the generic error: The status code returned from the server was: 500 Now try it again after placing the controls outside of the update panel. When you click the button you will get an exception page with details about a potentially dangerous/script-attack form value. The exception evens details a possible (though non-recommended) workaround of adding the attribute, ValidateRequest="false", to the aspx page directive. Of course for a real page it's a pain to strip out the update panels, so here is a quicker way to see the exception details. Just add the attribute, EnablePartialRendering="false", to your ScriptManager like below. Just set it back when you're done troubleshooting the issue.

No comments:

Post a Comment