|
(503) Server Unavailable ErrorPosted by Chris FullerFriday, November 6, 2009 |
We have an application that loads XHTML documents that are authored by
end-users into a database. This database is used by my client's
Intranet to deliver a combination of static and dynamic content to
employees through my client's Intranet.
I did not write the original application that loads this content in,
but I have been tasked with making modifications to it and supporting
it. This application ran fine for several months, but one day we
started getting, "The remote server returned an error: (503) Server
Unavailable", every time we loaded a document.
The code that was blowing up was pretty simple:
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(filePath);
filePath was the full path of the XHTML file, and we were blowing up
on the Load() method.
After some investigation, I determined that the DocType line in the
XHTML we were loading was causing the issue:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I found that if I put the w3.org address into Internet Explorer, I got
the same (503) Server Unavailable error as our application was
getting. Strangely enough, I did not get this error from FireFox.
To resolve the error, I used FireFox to pull the
xhtml1-transitional.dtd file down locally from w3.org, and the 3
associated files:
xhtml-special.ent
xhtml-symbol.ent
xhtml-lat1.ent
I put these files onto our web server, (www.myclient.com/Intranet/XML)
and changed the DOCTYPE line in the XHTML content to this:
"http://www.myclient.com/Intranet/XML/xhtml1-transitional.dtd">
This resolved the issue.
So why were we getting this "The remote server returned an error:
(503) Server Unavailable" error?
It turns out that w3.org was blocking requests from my client's external web server. Here is
an explanation:
http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic
2 Comments:
Alternatively you can change the code as follows:
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.XmlResolver = null;
xmlDocument.Load(filePath);
The XHTML I am uploading contains HTML characters such as
If I set the XmLResolver to null, I get errors on these characters. The error is:
Reference to undeclared entity 'nbsp'.
Thank you for the suggestion - there are often multiple ways to do things and I welcome any constructive feedback.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home