Slow performance of XmlTextWriter under IIS 7.5
<p>We are in need of building a large <strong>XML</strong> file that contains Google’s feed.
If we execute the code in a Console application, or in an ASP.NET site running under IIS Express on a local machine, it runs very fast.</p>

<p>If we execute it in an  ASP.net  environment under IIS 7.5 (either as a webforms or MVC site) it performs dramatically slower.</p>

<p>We use an <code>xmltextwriter</code> object and we read data by means of an <code>SqlDataReader</code>,
Every time a row is read we create different nodes and we write them to disc.</p>

<pre><code>xmlFeedWriterToFile = new XmlTextWriter(tempXmlfileName, Encoding.UTF8);
while (feedReader.Read())
{
    xmlFeedWriterToFile.WriteStartElement("item");
    // ID
    xmlFeedWriterToFile.WriteStartElement("id", "http://base.google.com/ns/1.0");
    if (this.ReturnSKULevelResults)
        // SKU-specific ID
        xmlFeedWriterToFile.WriteString(string.Format("{0}", feedReader.GetString(4)));
    else
    {
        xmlFeedWriterToFile.WriteString(string.Format("{0}_{1}", feedReader.GetString(1), feedReader.GetString(2)));
        xmlFeedWriterToFile.WriteEndElement();
    }
    // other code that writes XML nodes in the XmlTextWriter object
</code></pre>

<p>It seems that the ASP.Net application pool slows things down because the same routine is performed very fast in a console application.</p>

<p>We have also tried to deploy the web application on different WebServers but the result is the same: </p>

<p>Any idea to solve the issue would be appreciated.
Regards</p>
