RSS - Not a valid xml document

135 views
Skip to first unread message

freedom1029

unread,
Mar 10, 2008, 4:31:26 PM3/10/08
to ELMAH
Hi there I am no expert and really new to Elmah. I just installed
Elmah for .net 2.0 on my intranet and if I navigate to the rss page I
get the following xml:

<?xml version="1.0" encoding="utf-8" ?>
- <rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="0.91">
- <channel>
<title>Error log of /LM/W3SVC/1/Root/Clemex on SERVEUR</title>
<link>http://serveur/clemex/elmah.axd</link>
<description>Log of recent errors</description>
<language>en</language>
</channel>
</rss>

Now using SharpReader I would like to subscribe to my feed however
when I try to I get the following error:

Error parsing RSS XML: Not a valid xml document: This is an unexpected
token. The expected token is 'WHITESPACE'. Line 2, position 62.

I am doing something wrong?
Thanks,
Eric

Atif Aziz

unread,
Mar 10, 2008, 5:17:47 PM3/10/08
to el...@googlegroups.com
Hi Eric,

I just downloaded SharpReader v0.9.7.0 and subscribed to an RSS feed from a site running ELMAH BETA 2 (1.0.9414.1441) and it managed to pick up the feed and subscribe to it without any issues.

>>
Error parsing RSS XML: Not a valid xml document: This is an unexpected
token. The expected token is 'WHITESPACE'. Line 2, position 62.
<<

Have you tried to sniff the response and see SharpReader is getting? Did you provide http://serveur/clemex/elmah.axd as the URL to the feed to SharpReader?

Eric Chabot

unread,
Mar 11, 2008, 9:05:28 AM3/11/08
to el...@googlegroups.com
Thanks for your response Atif,
The feed URL used was http://serveur/clemex/elmah.axd/rss . Is this the
correct URL I should use?

Also I did a test and copied the source from this feed and put it in a
different xml file that I later published on the same
server(http://serveur/clemex/rss/test.xml). Then I subscribed to this
feed and guess what, it worked fine.

You mentionned something about sniffing the response that Sharpreader is
getting but I don't really know how to do that. Can you elaborate on
this.

Thanks,

Eric

Atif Aziz

unread,
Mar 11, 2008, 9:21:52 AM3/11/08
to el...@googlegroups.com
> The feed URL used was http://serveur/clemex/elmah.axd/rss.
> Is this the correct URL I should use?

That'll work fine and http://serveur/clemex/elmah.axd, without slash-rss appended, should also work equally well. In my testing, I didn't specify slash-rss. The error log page in ELMAH contains a hint to where the feed is located and SharpReader is good enough use that hint (like most modern feed readers).

>>
You mentionned something about sniffing the response that Sharpreader is
getting but I don't really know how to do that. Can you elaborate on
this.
>>

Use Fiddler, available from http://www.fiddlertool.com/.

Eric Chabot

unread,
Mar 11, 2008, 2:13:47 PM3/11/08
to el...@googlegroups.com

I tried what you said and used the URL http://serveur/clemex/elmah.axd
but I still have the same error.

With Fiddler what am I supposed to look for? The raw is giving me the
following:


HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Tue, 11 Mar 2008 18:14:36 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: application/xml; charset=utf-8
Content-Length: 1958

<?xml version="1.0" encoding="utf-8"?>

<channel>
<title>Error log of /LM/W3SVC/1/Root/Clemex on SERVEUR</title>
<link>http://serveur/clemex/elmah.axd</link>
<description>Log of recent errors</description>
<language>en</language>

<item>
<title>The file '/clemex/intranet_home.aspx' does not
exist.</title>
<description>An error of type System.Web.HttpException occurred.
The file '/clemex/intranet_home.aspx' does not exist.</description>
<pubDate>Tue, 11 Mar 2008 18:00:20 GMT</pubDate>

<link>http://serveur/clemex/elmah.axd/detail?id=020D724E-62E2-4D3A-BDE4-
7C5931DD8D9A</link>
</item>
<item>
<title>The file '/clemex/intrabet_home.aspx' does not
exist.</title>
<description>An error of type System.Web.HttpException occurred.
The file '/clemex/intrabet_home.aspx' does not exist.</description>
<pubDate>Tue, 11 Mar 2008 18:00:16 GMT</pubDate>

<link>http://serveur/clemex/elmah.axd/detail?id=0B546E2A-7170-49FA-8C9B-
3508CA02839D</link>
</item>
<item>
<title>The file '/clemex/Cl_Leads.aspx' does not exist.</title>
<description>An error of type System.Web.HttpException occurred.
The file '/clemex/Cl_Leads.aspx' does not exist.</description>
<pubDate>Mon, 10 Mar 2008 20:33:52 GMT</pubDate>

<link>http://serveur/clemex/elmah.axd/detail?id=5908382F-8A7D-4C5F-9002-
605CC5BCD292</link>
</item>
<item>
<title>The file '/clemex/customer.aspx' does not exist.</title>
<description>An error of type System.Web.HttpException occurred.
The file '/clemex/customer.aspx' does not exist.</description>
<pubDate>Mon, 10 Mar 2008 20:33:27 GMT</pubDate>

<link>http://serveur/clemex/elmah.axd/detail?id=E619C733-C3D8-41EA-A30F-
67CA7530DAD4</link>
</item>
</channel>
</rss>

Atif Aziz

unread,
Mar 12, 2008, 4:36:30 AM3/12/08
to el...@googlegroups.com
The sniffed response looks fine so I can't imagine at this point why SharpReader is having any trouble. Incidentally, have you tried it with another reader (like RSS Bandit at http://www.rssbandit.org/) just to rule out the possibility that the problem may be on SharpReader's end? Also, are you using SharpReader v0.9.7.0 and ELMAH BETA 2 (1.0.9414.1441) or different versions than what I tested on?

Eric Chabot

unread,
Mar 12, 2008, 9:40:05 AM3/12/08
to el...@googlegroups.com
Yes I have the latest version of Sharpreader v0.9.7.0

I also tried 2 other readers but they all give me an error when I try
one or the other URL.

RssReader 1.0.96.2 Beta
Error: Feed nota a valid RSS or Atom format, maybe the provided feed URL
point to a HTML page instead of RSS or Atom feed.

RSS Bandit
Error: Sorry, no feed could be found

At the bottom of the page http://serveur/clemex/elmah.axd I see Powered
by ELMAH, version 1.0.9414.1441
On the About page I can read: This release (SCC #248) build was compiled
from the following sources for CLR v2.0.50727:

Thanks again for trying to help,

Atif Aziz

unread,
Mar 12, 2008, 11:24:00 AM3/12/08
to el...@googlegroups.com
Sorry to keep asking you to try out different things, but does it make any difference if you access the "Digest RSS" feed instead of the error log. That is, http://serveur/clemex/elmah.axd/digestrss instead of http://serveur/clemex/elmah.axd/rss? I'm wondering if the readers are able to pick the second feed or do both demonstrate the same oddity.

Eric Chabot

unread,
Mar 12, 2008, 12:08:07 PM3/12/08
to el...@googlegroups.com

Dont be sorry, you are helping me! Keep the questions coming, we will
at some point find the problem I am sure.

To get back to your latest question well it makes no difference, all
readers are not able to read neither of them
-http://serveur/clemex/elmah.axd/digestrss
-http://serveur/clemex/elmah.axd/ or
-http://serveur/clemex/elmah.axd/rss

Atif Aziz

unread,
Mar 12, 2008, 1:11:28 PM3/12/08
to el...@googlegroups.com
Would it be possible for you to ask Fiddler to save the request and response to a file and then send those files as attachments to your post to this discussion group? That way, I can dig into those files. It could be that there is an offending character in the response that's due to one of the error messages. It would be also interesting to clear your log and see if the RSS reader can read the blank feed. That would tell the RSS is structurally correct but being corrupted by one of the logged errors.

Thanks.

Eric Chabot

unread,
Mar 12, 2008, 1:37:20 PM3/12/08
to el...@googlegroups.com
Here are the present request and response from fiddler.

Even from the start (empty log) I was getting the same error but just to
be sure let me empty my logs and I will post back the request and
response as well. This might sound stupid but could you tell me how to
clear the logs? Do I have to clear the table directly or their is some
other way?

Response.txt
Request.txt

Atif Aziz

unread,
Mar 12, 2008, 1:40:31 PM3/12/08
to el...@googlegroups.com
> Here are the present request and response from fiddler.

Thanks, but unfortunately, I was expecting the RSS response. You've sent the response from the error log home page that contains only HTML.

> Do I have to clear the table directly or their is some other way?

If you're using the SQL Server then you have to manually clear the table. If you're using SQLite database file or XML files for log then you just delete those. There's no UI for clearing the log.

Eric Chabot

unread,
Mar 12, 2008, 1:55:30 PM3/12/08
to el...@googlegroups.com

Ok so here are the resquest and response with an empty log from the url
http://serveur/clemex/elmah.axd/rss
Response.txt
Request.txt

Atif Aziz

unread,
Mar 15, 2008, 11:01:09 AM3/15/08
to el...@googlegroups.com
Eric, my week ended busy so I couldn't dig into this further until now. I've looked at the request and response files and I can't imagine anymore what could be possibly going wrong. The response looks clear and SharpReader should be able to pick it up. Have you tried with a different RSS reader? What does IE 7 show when you try to view the feed directly in the browser?

>>
Also I did a test and copied the source from this feed and put it in a different xml file that I later published on the same server(http://serveur/clemex/rss/test.xml).
<<

What if you were to take the static test.xml and rename it to test.aspx while maintaining the content. Does SharpReader fail then? I'm wondering if there's something in the ASP.NET pipeline that's corrupting the response.

- Atif

Eric Chabot

unread,
Mar 18, 2008, 9:52:46 AM3/18/08
to el...@googlegroups.com

>>Have you tried with a different RSS reader?<<

Yes I tried 3 different readers. As previously mentionned:


"I also tried 2 other readers but they all give me an error when I try
one or the other URL.

RssReader 1.0.96.2 Beta
Error: Feed nota a valid RSS or Atom format, maybe the provided feed URL
point to a HTML page instead of RSS or Atom feed.

RSS Bandit
Error: Sorry, no feed could be found"

>>What does IE 7 show when you try to view the feed directly in the
browser?<<

It looks normal to me, here is the source viewed by IE7:


<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="0.91">
<channel>
<title>Error log of /LM/W3SVC/1/Root/Clemex on SERVEUR</title>
<link>http://serveur/clemex/elmah.axd</link>
<description>Log of recent errors</description>
<language>en</language>

</channel>
</rss>

>>What if you were to take the static test.xml and rename it to
test.aspx while maintaining the content. Does SharpReader fail then? I'm
wondering if there's something in the ASP.NET pipeline that's corrupting
the response.<<

I changed the extension to aspx instead of xml
(http://serveur/clemex/rss/test.aspx) as you suggested and tried to
subscribe to the feed and It does fail with the same error. I changed
back the extension to xml and sharpeReader was able to subscribe.

Atif Aziz

unread,
Mar 18, 2008, 12:43:34 PM3/18/08
to el...@googlegroups.com
>>
I changed the extension to aspx instead of xml
(http://serveur/clemex/rss/test.aspx) as you suggested and tried to
subscribe to the feed and It does fail with the same error. I changed
back the extension to xml and sharpeReader was able to subscribe.
<<

Given this observation, I imagine then that there is another component in the pipeline (another HTTP module or handler registered in web.config or machine.config?) that seems to be interfering with the output. It doesn't look like it's a problem originating from ELMAH.

Eric Chabot

unread,
Mar 18, 2008, 2:06:42 PM3/18/08
to el...@googlegroups.com
Interesting.
Do you see anything in the following (form my web.config)that could
interfere?
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd"
validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
<add verb="GET,HEAD,POST" path="*.asbx"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add verb="POST,GET,HEAD" path="elmah.axd"
type="Elmah.ErrorLogPageFactory, Elmah"/>
</httpHandlers>

<httpModules>
<add name="ScriptModule"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule,
Elmah"/>
</httpModules>

<globalization requestEncoding="utf-8"
responseEncoding="utf-8" culture="en-US" uiCulture="en"/>
<authentication mode="Forms">
<forms loginUrl="login.aspx" protection="All"
timeout="43200" path="/" requireSSL="false" slidingExpiration="true"
cookieless="UseCookies" name=".ClemexIntFormAuth"/>
</authentication>
<authorization>
<!-- <allow users="?" /> -->
<deny users="?"></deny>
</authorization>
<!-- <xhtmlConformance mode="Legacy"/>-->


</system.web>


<system.webServer>
<validation
validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule"
preCondition="integratedMode" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove
name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*"
path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices"
verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource"
preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ASBXHandler" verb="GET,HEAD,POST"
path="*.asbx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>
</configuration>

Eric

unread,
Mar 19, 2008, 10:07:56 AM3/19/08
to ELMAH
Another hint:

try to rename "elmah.axd" to another name, like "result.elmah" (-->
Extension needs to be enabled in IIS).

I haven't tested it but I can imagine that there's a feedback with the
diagnostics tracing.

Do you have tracing enabled in your application?


Eric

Eric

unread,
Mar 19, 2008, 10:34:16 AM3/19/08
to ELMAH
To be more specific:

Change in handler section
<add verb="POST,GET,HEAD" path="elmah.axd"
type="Elmah.ErrorLogPageFactory, Elmah"/>

To

<add verb="POST,GET,HEAD" path="result.elmah"
type="Elmah.ErrorLogPageFactory, Elmah"/>

And add the extension .elmah in the IIS manager:
ISS Manager -> Propery of Web Site -> Tab 'Home Directory' ->
Configuration -> Tab 'Mappings'.
Add the new extension, use same settings like for .axd

I hope this helps.

Atif Aziz

unread,
Mar 19, 2008, 2:39:18 PM3/19/08
to el...@googlegroups.com
Chabot, I see something in your configuration that could reveal the problem. I see that you're using forms authentication and you deny access to all anonymous users:

<authentication mode="Forms">
...


</authentication>
<authorization>
<!-- <allow users="?" /> -->
<deny users="?"></deny>
</authorization>

I believe the SharpReader is trying to access your web site like an anonymous user. Could it be then that it's getting back the HTML from the login screen instead of the RSS feed? It tries to parse the HTML as XML and RSS but obviously fails. This would explain why the static copy of the feed works when it has the XML extension but fails when it uses ASPX. The XML extension is handled and served directly by IIS. ASP.NET is not involved so there is no authentication challenge taking place. When the same file is renamed to have an ASPX extension then the ASP.NET pipeline gets involved. To confirm this theory, could exclude elmah.axd from the authorization rule or turn off authentication and authorization temporarily to see if SharpReader can then get to the feed.

Eric Chabot

unread,
Mar 25, 2008, 3:28:28 PM3/25/08
to el...@googlegroups.com
That was it! Sorry that I did not think about it myself.
So I got around it by adding the following lines to my web.config. This way
I allow anonymous user to get access.

<location path="elmah.axd">
<system.web>
<authorization>
<allow users="*"/>

</authorization>
</system.web>
</location>


Thanks for all your help Atif,

Atif Aziz

unread,
Apr 10, 2008, 6:40:37 PM4/10/08
to el...@googlegroups.com
I may be a bit late on this, but FWIW (and for some future passerby), I wrote a solution called MADAM that addresses exactly this problem. You might want to read up on it if you are interested in securing the RSS from ELMAH nonetheless. The problem and solution is discussed in detail in the following MSDN article written together with co-author Scott Mitchell:

http://msdn2.microsoft.com/en-us/library/aa479391.aspx

Reply all
Reply to author
Forward
0 new messages