Language: C# 5.0
Platform: ASP.Net 4.5 on IIS 7.5
Operating System: Windows Server 2008 R2 Standard 64-bit
I am working on an old Web Forms application to add XML Sitemaps which are dynamically generated from our database. I created a generic handler (.ashx) and am building XML with a XmlWriter. I called site.com/SitemapIndex.ashx and voila! So far so good.
I have a business requirement that the sitemap end with the .xml extension. I added a simple URL rewrite rule to my web.config and my local rig processes SitemapIndex.xml through the SitemapIndex.ashx file.
When I deploy the solution to our staging server, I got a 404 not found error on the SitemapIndex.xml file. But the .ashx still worked, so I added a handler mapping on that server. I used a Managed Handler for the path *.xml that uses the System.Web.UI.SimpleHandlerFactory. When I requested SitemapIndex.xml again the output rendered correctly.
Then I tried to request a physical XML file on the server and received the following error message: "There is no build provider registered for the extension '.xml'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'."
For now I can process .xml files dynamically through my .ashx handlers, but real xml files will no longer be served. I need to do both. Any help much appreciated!